Skip to content

Commit

Permalink
Rework --help a bit
Browse files Browse the repository at this point in the history
  • Loading branch information
kLabz committed Apr 21, 2024
1 parent 12ba28b commit 54e542d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
19 changes: 10 additions & 9 deletions src/HaxeDownload.hx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class HaxeDownload {
case [v]: downloadRelease(v);
case [v, alias]: downloadRelease(v, alias);

case _: displayUsage();
case _:
Sys.println("hx download: missing argument(s)\n");
displayUsage();
}
}

Expand Down Expand Up @@ -64,22 +66,21 @@ class HaxeDownload {
});
}

static function displayUsage() {
public static function displayUsage() {
Sys.println([
"hx-download: missing argument(s)",
"",
"Usage: hx-download <VERSION> [AS_NAME]",
"Usage: hx download <VERSION> [AS_NAME]",
" Download official release VERSION (e.g., 4.3.0)",
" Save as AS_NAME if provided or use version number",
"",
" or: hx-download latest [AS_NAME]",
" or: hx download latest [AS_NAME]",
" Download latest nightly",
" Save as AS_NAME if provided or use version number (with revision)",
"",
" or: hx-download nightly <VERSION> [AS_NAME]",
" or: hx-download aws <VERSION> [AS_NAME]",
" or: hx download nightly <VERSION> [AS_NAME]",
" or: hx download aws <VERSION> [AS_NAME]",
" Download specific nightly VERSION (e.g., 2023-01-22_development_dd5e467)",
" Save as AS_NAME if provided or use version number (with revision)"
" Save as AS_NAME if provided or use version number (with revision)",
" Note: short hash VERSION is also supported for development nightlies (e.g. dd5e467)"
].join("\n"));
}
}
3 changes: 3 additions & 0 deletions src/HaxeManager.hx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class HaxeManager {
Sys.println(Utils.getCurrentName().or("") + ' (' + Utils.getCurrent() + ')');

case ["--help", []]: displayUsage();
case ["--help", ["download"]]: HaxeDownload.displayUsage();
case ["--help", ["select"]]: HaxeSelect.displayUsage();

case [v, []]: HaxeSelect.select(v);
case _: throw 'Invalid arguments';
}
Expand Down
2 changes: 1 addition & 1 deletion src/HaxeSelect.hx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class HaxeSelect {
Sys.command("haxe", ["-version"]);
}

static function displayUsage() {
public static function displayUsage() {
// TODO: proper help message
Sys.println("Please specify a haxe version");
}
Expand Down

0 comments on commit 54e542d

Please sign in to comment.