Skip to content

Commit a494d0b

Browse files
committed
Update README and extra tools
1 parent f559404 commit a494d0b

File tree

6 files changed

+62
-30
lines changed

6 files changed

+62
-30
lines changed

README.md

+31-14
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,61 @@
11
# Haxe Manager
22

3-
Easily download and switch haxe versions on UNIX (currently tested on
4-
`ubuntu-latest` and `macos-latest` via github actions).
3+
Easily download and switch haxe versions (currently tested on
4+
`ubuntu-latest`, `macos-latest` and `windows-latest` via github actions).
55

6-
Run `install.sh` and update `PATH` / `HAXE_STD_PATH` as requested.
6+
Run `install.sh` (`install.bat` on Windows) and update `PATH` / `HAXE_STD_PATH` as
7+
requested.
78

89
## Select a version
910

10-
Run `hx` to display the haxe version switch (using [`fzf`](https://github.com/junegunn/fzf)).
11+
Run `hx` to display the haxe version switch (using a Haxe port of [`fzf`](https://github.com/junegunn/fzf)
12+
picker).
1113

12-
You can also skip the version picker by using directly `hx 4.3.0` (or any other
13-
version/alias you have installed).
14+
You can also skip the version picker by using directly `hx 4.3.0` or `hx select
15+
4.3.0` (or any other version/alias you have installed).
1416

1517
## Installing / updating versions
1618

17-
Use `hx-download` tool to download haxe versions:
19+
Use `hx download` tool to download haxe versions:
1820

1921
```
20-
Usage: hx-download <VERSION> [AS_NAME]
22+
Usage: hx download <VERSION> [AS_NAME]
2123
Download official release VERSION (e.g., 4.3.0)
2224
Save as AS_NAME if provided or use version number
2325
24-
or: hx-download latest [AS_NAME]
26+
or: hx download latest [AS_NAME]
2527
Download latest nightly
2628
Save as AS_NAME if provided or use version number (with revision)
2729
28-
or: hx-download nightly <VERSION> [AS_NAME]
30+
or: hx download nightly <VERSION> [AS_NAME]
31+
or: hx download aws <VERSION> [AS_NAME]
2932
Download specific nightly VERSION (e.g., 2023-01-22_development_dd5e467)
3033
Save as AS_NAME if provided or use version number (with revision)
34+
Note: short hash VERSION is also supported for development nightlies (e.g. dd5e467)
3135
```
3236

37+
## List available versions
38+
39+
Use `hx list` to get a list of all haxe versions available throught your (local)
40+
haxe-manager.
41+
42+
## Display currently selected version
43+
44+
Use `hx current` to display currently selected Haxe version string (equivalent
45+
to running `haxe --version`).
46+
47+
On Unix, you can also run:
48+
- `hx current --name` to get the name under which that version is installed
49+
- `hx current --full` to get both name and version string (`[NAME] ([VERSION])`)
50+
3351
## Included tools
3452

3553
`extra/` folder contains optional tools you can install individually with their
3654
`install.sh` script or all at once with `install-all.sh`.
3755

56+
Note that those have been written when Haxe Manager was unix only and probably
57+
can't work at all on Windows.
58+
3859
### `hxfzf`
3960

4061
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)
7394

7495
Update your local (git) copy of haxe-manager.
7596

76-
### `list-haxe-versions`
77-
78-
Get a list of all haxe versions available throught your (local) haxe-manager.
79-
8097
### `rofi-haxe`
8198

8299
[rofi](https://github.com/davatorium/rofi) wrapper to `hx` command, to graphically select a Haxe version.

extra/fzf/hxfzf.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@ done
4141
echo "$folders" \
4242
| tr '\n' ' ' \
4343
| xargs ag --hidden --silent -f -g ".hx" \
44-
| grep -v "^/opt/haxe/std/\($targetFilter\)/"
44+
| grep -v "^/opt/haxe/current/std/\($targetFilter\)/"

extra/rofi/rofi-haxe.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/bin/bash
22

3-
version=$(list-haxe-versions | rofi -dmenu -p "Set haxe version to" -no-custom -matching fuzzy -sorting-method fzf); hx-select $version
3+
version=$(hx list | rofi -dmenu -p "Set haxe version to" -no-custom -matching fuzzy -sorting-method fzf); hx select $version

src/HaxeManager.hx

+27-11
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ class HaxeManager {
1818
case ["current", []]: Sys.println(Utils.getCurrent().or(""));
1919
case ["current", ["--name"]]:
2020
if (Sys.systemName() == "Windows")
21-
throw "`hx current --name` is not supported on windows";
21+
throw "`hx current --name` is not supported on Windows";
2222

2323
Sys.println(Utils.getCurrentName().or(""));
2424

2525
case ["current", ["--full"]]:
2626
if (Sys.systemName() == "Windows")
27-
throw "`hx current --full` is not supported on windows";
27+
throw "`hx current --full` is not supported on Windows";
2828

2929
Sys.println(Utils.getCurrentFull().or(""));
3030

@@ -47,7 +47,7 @@ class HaxeManager {
4747
var BOLD = ANSI.set(Bold);
4848
var BOLD_OFF = ANSI.set(BoldOff);
4949

50-
Sys.println([
50+
var lines = [
5151
'${ORANGE}hx - Haxe Manager cli tool${RESET}',
5252
'${UNDERLINE}https://github.com/kLabz/haxe-manager${UNDERLINE_OFF}',
5353
'',
@@ -63,20 +63,36 @@ class HaxeManager {
6363
' or: ${ORANGE}hx select ${UNDERLINE}<VERSION>${RESET}',
6464
' Switch to installed Haxe version ${BOLD}VERSION${BOLD_OFF}',
6565
'',
66-
' or: ${ORANGE}hx current${RESET}',
67-
' or: ${ORANGE}hx current --name${RESET}',
68-
' or: ${ORANGE}hx current --full${RESET}',
69-
' Display current Haxe version string',
70-
' ${BOLD}--name${BOLD_OFF} will display the name under which this version has been installed',
71-
' ${BOLD}--full${BOLD_OFF} will display both name and version string',
72-
'',
66+
];
67+
68+
if (Sys.systemName() == "Windows") {
69+
lines = lines.concat([
70+
' or: ${ORANGE}hx current${RESET}',
71+
' Display current Haxe version string',
72+
'',
73+
]);
74+
} else {
75+
lines = lines.concat([
76+
' or: ${ORANGE}hx current${RESET}',
77+
' or: ${ORANGE}hx current --name${RESET}',
78+
' or: ${ORANGE}hx current --full${RESET}',
79+
' Display current Haxe version string',
80+
' ${BOLD}--name${BOLD_OFF} will display the name under which this version has been installed',
81+
' ${BOLD}--full${BOLD_OFF} will display both name and version string',
82+
'',
83+
]);
84+
}
85+
86+
lines = lines.concat([
7387
' or: ${ORANGE}hx list${RESET}',
7488
' Display all installed Haxe versions',
7589
'',
7690
' or: ${ORANGE}hx --help${RESET}',
7791
' or: ${ORANGE}hx --help download${RESET}',
7892
' or: ${ORANGE}hx --help select${RESET}',
7993
' Display help about available commands'
80-
].join("\n"));
94+
]);
95+
96+
Sys.println(lines.join("\n"));
8197
}
8298
}

src/fuzzaldrin/Filter.hx

-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import fuzzaldrin.Scorer;
66
typedef ResolvedCandidate<T> = {
77
candidate:T,
88
string:String,
9-
// TODO: highlighted string AST
109
score:Score
1110
}
1211

src/tools/Utils.hx

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class Utils {
3535
}
3636

3737
public static function getBuildUrl(v:String):Array<String> {
38-
// TODO: other OS, and arch variants
38+
// TODO: arch variants
3939
return switch Sys.systemName() {
4040
case "Linux":
4141
['https://build.haxe.org/builds/haxe/linux64/', 'haxe_$v.tar.gz'];
@@ -48,7 +48,7 @@ class Utils {
4848
}
4949

5050
public static function getReleaseUrl(v:String):Array<String> {
51-
// TODO: other OS, and arch variants
51+
// TODO: arch variants
5252
return switch Sys.systemName() {
5353
case "Linux":
5454
['https://github.com/HaxeFoundation/haxe/releases/download/$v/', 'haxe-$v-linux64.tar.gz'];

0 commit comments

Comments
 (0)