Skip to content

Commit 8ddbad7

Browse files
committed
[hx download] allow 'hx download [sha]' syntax (skip 'nightlies' arg)
1 parent 088ad65 commit 8ddbad7

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/HaxeDownload.hx

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ class HaxeDownload {
2727
case [v] if (SemVer.isValid(v)): downloadRelease(v);
2828
case [v, alias] if (SemVer.isValid(v)): downloadRelease(v, alias);
2929

30+
case [v] if (HaxeNightlies.isValid(v)): downloadNightly(v);
31+
case [v, alias] if (HaxeNightlies.isValid(v)): downloadNightly(v, alias);
32+
3033
case [v] | [v, _]:
3134
Utils.displayError('hx download: $v is not a valid release version\n');
3235
displayUsage();

src/HaxeNightlies.hx

+5-1
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,15 @@ class HaxeNightlies {
99
static var ref_check = ~/^[a-f0-9]{7,}$/i;
1010

1111
public static function resolve(ref:String):String {
12-
if (ref_check.match(ref)) return getNightly(ref);
1312
if (SemVer.isValid(ref)) return getNightly(ref, true);
13+
if (isValid(ref)) return getNightly(ref);
1414
return ref;
1515
}
1616

17+
public static function isValid(ref:String):Bool {
18+
return ref_check.match(ref);
19+
}
20+
1721
static function getNightly(ref:String, ?isTag:Bool = false):Null<String> {
1822
final date = getCommitDate(ref);
1923
if (date == null) {

0 commit comments

Comments
 (0)