Note: This is a modified version of the haxex script created by @jasononeil and @clarkjones
Modifications from orginal
- Haxe compiler args: Use libs, etc. See
haxe --help
- Help: Execute script without arguments to print help.
- PWD support: Allow execution from any directory. E.g.
bin/MyScript.hx
without requiring a package. - Bootstrap: Instantly create a new script. See help message.
This is a tiny shell script that you can use to make scripting with Haxe very straight forward.
Using a straight #!/usr/bin/haxe doesn't work currently, as the Haxe compiler will have to be a little more clever about realising it is a shell script and that we wish to execute it. Maybe this will be native some day, for now, you can install the script below into /usr/bin/haxex
or /usr/local/bin/haxex
and then use that.
Installation:
sudo nano /usr/bin/haxex
, paste the 'haxex' file in theresudo chmod +x /usr/bin/haxex
Help (see Notes section for limitions):
haxex
(execute without args)
Bootstrap:
haxex bootstrap bin/MyFirstScript.hx
haxelib install mcli
bin/MyFirstScript.hx
Simple Example:
#!/usr/bin/env haxex -debug @
class MyScript
{
public static function main()
{
trace('My Script is executing!');
#if debug
trace('with debug flag!');
#end
}
}
Running:
chmod +x MyScript.hx
./MyScript.hx
For the included HaxeScript:
haxelib install mcli
chmod +x HaxeScript.hx
./HaxeScript.hx [yourname] --loud