diff --git a/README.md b/README.md index 8447a6f..815fc64 100644 --- a/README.md +++ b/README.md @@ -1,40 +1,61 @@ # Haxe Manager -Easily download and switch haxe versions on UNIX (currently tested on -`ubuntu-latest` and `macos-latest` via github actions). +Easily download and switch haxe versions (currently tested on +`ubuntu-latest`, `macos-latest` and `windows-latest` via github actions). -Run `install.sh` and update `PATH` / `HAXE_STD_PATH` as requested. +Run `install.sh` (`install.bat` on Windows) and update `PATH` / `HAXE_STD_PATH` as +requested. ## Select a version -Run `hx` to display the haxe version switch (using [`fzf`](https://github.com/junegunn/fzf)). +Run `hx` to display the haxe version switch (using a Haxe port of [`fzf`](https://github.com/junegunn/fzf) +picker). -You can also skip the version picker by using directly `hx 4.3.0` (or any other -version/alias you have installed). +You can also skip the version picker by using directly `hx 4.3.0` or `hx select +4.3.0` (or any other version/alias you have installed). ## Installing / updating versions -Use `hx-download` tool to download haxe versions: +Use `hx download` tool to download haxe versions: ``` -Usage: hx-download [AS_NAME] +Usage: hx download [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 [AS_NAME] + or: hx download nightly [AS_NAME] + or: hx download aws [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) + Note: short hash VERSION is also supported for development nightlies (e.g. dd5e467) ``` +## List available versions + +Use `hx list` to get a list of all haxe versions available throught your (local) +haxe-manager. + +## Display currently selected version + +Use `hx current` to display currently selected Haxe version string (equivalent +to running `haxe --version`). + +On Unix, you can also run: +- `hx current --name` to get the name under which that version is installed +- `hx current --full` to get both name and version string (`[NAME] ([VERSION])`) + ## Included tools `extra/` folder contains optional tools you can install individually with their `install.sh` script or all at once with `install-all.sh`. +Note that those have been written when Haxe Manager was unix only and probably +can't work at all on Windows. + ### `hxfzf` Prints a list of all `.hx` files in all your classpath, to be passed to `fzf` @@ -73,10 +94,6 @@ the path to your repository if you're executing from somewhere else) Update your local (git) copy of haxe-manager. -### `list-haxe-versions` - -Get a list of all haxe versions available throught your (local) haxe-manager. - ### `rofi-haxe` [rofi](https://github.com/davatorium/rofi) wrapper to `hx` command, to graphically select a Haxe version. diff --git a/extra/fzf/hxfzf.sh b/extra/fzf/hxfzf.sh index a9dda71..ce1d841 100644 --- a/extra/fzf/hxfzf.sh +++ b/extra/fzf/hxfzf.sh @@ -41,4 +41,4 @@ done echo "$folders" \ | tr '\n' ' ' \ | xargs ag --hidden --silent -f -g ".hx" \ - | grep -v "^/opt/haxe/std/\($targetFilter\)/" + | grep -v "^/opt/haxe/current/std/\($targetFilter\)/" diff --git a/extra/rofi/rofi-haxe.sh b/extra/rofi/rofi-haxe.sh index 374a47e..ae43f68 100644 --- a/extra/rofi/rofi-haxe.sh +++ b/extra/rofi/rofi-haxe.sh @@ -1,3 +1,3 @@ #!/bin/bash -version=$(list-haxe-versions | rofi -dmenu -p "Set haxe version to" -no-custom -matching fuzzy -sorting-method fzf); hx-select $version +version=$(hx list | rofi -dmenu -p "Set haxe version to" -no-custom -matching fuzzy -sorting-method fzf); hx select $version diff --git a/src/HaxeManager.hx b/src/HaxeManager.hx index 4334936..9efad0a 100644 --- a/src/HaxeManager.hx +++ b/src/HaxeManager.hx @@ -18,13 +18,13 @@ class HaxeManager { case ["current", []]: Sys.println(Utils.getCurrent().or("")); case ["current", ["--name"]]: if (Sys.systemName() == "Windows") - throw "`hx current --name` is not supported on windows"; + throw "`hx current --name` is not supported on Windows"; Sys.println(Utils.getCurrentName().or("")); case ["current", ["--full"]]: if (Sys.systemName() == "Windows") - throw "`hx current --full` is not supported on windows"; + throw "`hx current --full` is not supported on Windows"; Sys.println(Utils.getCurrentFull().or("")); @@ -47,7 +47,7 @@ class HaxeManager { var BOLD = ANSI.set(Bold); var BOLD_OFF = ANSI.set(BoldOff); - Sys.println([ + var lines = [ '${ORANGE}hx - Haxe Manager cli tool${RESET}', '${UNDERLINE}https://github.com/kLabz/haxe-manager${UNDERLINE_OFF}', '', @@ -63,13 +63,27 @@ class HaxeManager { ' or: ${ORANGE}hx select ${UNDERLINE}${RESET}', ' Switch to installed Haxe version ${BOLD}VERSION${BOLD_OFF}', '', - ' or: ${ORANGE}hx current${RESET}', - ' or: ${ORANGE}hx current --name${RESET}', - ' or: ${ORANGE}hx current --full${RESET}', - ' Display current Haxe version string', - ' ${BOLD}--name${BOLD_OFF} will display the name under which this version has been installed', - ' ${BOLD}--full${BOLD_OFF} will display both name and version string', - '', + ]; + + if (Sys.systemName() == "Windows") { + lines = lines.concat([ + ' or: ${ORANGE}hx current${RESET}', + ' Display current Haxe version string', + '', + ]); + } else { + lines = lines.concat([ + ' or: ${ORANGE}hx current${RESET}', + ' or: ${ORANGE}hx current --name${RESET}', + ' or: ${ORANGE}hx current --full${RESET}', + ' Display current Haxe version string', + ' ${BOLD}--name${BOLD_OFF} will display the name under which this version has been installed', + ' ${BOLD}--full${BOLD_OFF} will display both name and version string', + '', + ]); + } + + lines = lines.concat([ ' or: ${ORANGE}hx list${RESET}', ' Display all installed Haxe versions', '', @@ -77,6 +91,8 @@ class HaxeManager { ' or: ${ORANGE}hx --help download${RESET}', ' or: ${ORANGE}hx --help select${RESET}', ' Display help about available commands' - ].join("\n")); + ]); + + Sys.println(lines.join("\n")); } } diff --git a/src/fuzzaldrin/Filter.hx b/src/fuzzaldrin/Filter.hx index 43a75a4..3601159 100644 --- a/src/fuzzaldrin/Filter.hx +++ b/src/fuzzaldrin/Filter.hx @@ -6,7 +6,6 @@ import fuzzaldrin.Scorer; typedef ResolvedCandidate = { candidate:T, string:String, - // TODO: highlighted string AST score:Score } diff --git a/src/tools/Utils.hx b/src/tools/Utils.hx index d2e823b..7931842 100644 --- a/src/tools/Utils.hx +++ b/src/tools/Utils.hx @@ -35,7 +35,7 @@ class Utils { } public static function getBuildUrl(v:String):Array { - // TODO: other OS, and arch variants + // TODO: arch variants return switch Sys.systemName() { case "Linux": ['https://build.haxe.org/builds/haxe/linux64/', 'haxe_$v.tar.gz']; @@ -48,7 +48,7 @@ class Utils { } public static function getReleaseUrl(v:String):Array { - // TODO: other OS, and arch variants + // TODO: arch variants return switch Sys.systemName() { case "Linux": ['https://github.com/HaxeFoundation/haxe/releases/download/$v/', 'haxe-$v-linux64.tar.gz'];