-
-
Save clarkjones/9c7c05b64c5b2b0763c2 to your computer and use it in GitHub Desktop.
Revisions
-
clarkjones revised this gist
Oct 8, 2015 . 1 changed file with 10 additions and 6 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,17 @@ #!/bin/bash args=$@ # Create compiler args compArgs=${args/@*/" --run"} # Create string to match and remove compiler args compMatch=${compArgs/ --run/"@"} # Get cli args by removing compiler args cliArgs=${args/${compMatch}/""} set -- $cliArgs # Give filename its own var filename=$1 # Set args to be passed to script cliArgs=${@:2} -
clarkjones revised this gist
Oct 8, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,8 @@ #!/bin/bash compArgs=$@ # Get cli args cliArgs=${compArgs/*@/""} # Get compiler args compArgs=${compArgs/@*/" --run"} -
clarkjones revised this gist
Oct 8, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ cliArgs=${compArgs/* @/""} compArgs=${compArgs/@*/" --run"} set -- $cliArgs # Give file name its own var filename=$1 # Set args to be passed to script cliArgs=${@:2} -
clarkjones revised this gist
Oct 8, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -2,12 +2,12 @@ compArgs=${@:1} # Get cli args cliArgs=${compArgs/* @/""} # Get compiler args compArgs=${compArgs/@*/" --run"} set -- $cliArgs # Give file name into its own var filename=$1 # Set args to be passed to script cliArgs=${@:2} -
clarkjones revised this gist
Oct 8, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ cliArgs=${compArgs/*@/""} compArgs=${compArgs/@*/" --run"} set -- $cliArgs # Give filename its own var filename=$1 # Set args to be passed to script cliArgs=${@:2} -
clarkjones revised this gist
Oct 8, 2015 . 2 changed files with 15 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -49,6 +49,4 @@ What this script actually does: Limitations: If your script is in the root package (has no `package` statement at the top of the file), then you need to call it from the directory the script is in. If your script is in a sub-package, you need to call it from the root-level package. Easy rule of thumb: don't use packages, and call from the directory the script is in. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,24 @@ #!/bin/bash compArgs=${@:1} # Get cli args cliArgs=${compArgs/*@/""} # Get compiler args compArgs=${compArgs/@*/" --run"} set -- $cliArgs # Give file name into its own var filename=$1 # Set args to be passed to script cliArgs=${@:2} # Remove ".hx" if it's there filename=${filename/\.hx/""} # Remove "./" if it's there filename=${filename/\.\//""} # Change "/" to "." filename=${filename/\//"."} haxe $compArgs $filename $cliArgs -
clarkjones revised this gist
Oct 8, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,7 +7,7 @@ This is a tiny shell script that you can use to make scripting with Haxe very st 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` and then use that. Installation: **if you're using OS X El Capitan you'll probably need to put haxex in /usr/local/bin/** 1. `sudo nano /usr/bin/haxex`, paste the 'haxex' file in there 2. `sudo chmod +x /usr/bin/haxex` -
clarkjones revised this gist
Oct 7, 2015 . 2 changed files with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/usr/bin/env haxex -lib mcli @ /** Taken from mcli example https://github.com/waneck/mcli Say hello. Example inspired by ruby's "executable" lib example **/ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ **Note: This is a modified version of the haxex script created by @jasononeil** **This version allows for specifying compiler args in your script. so you can include and use libraries like mcli** -
clarkjones revised this gist
Oct 7, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,8 +33,8 @@ Running: ./MyScript.hx For the included HaxeScript: haxelib install mcli chmod +x HaxeScript.hx ./HaxeScript.hx [yourname] --loud -
clarkjones revised this gist
Oct 7, 2015 . 1 changed file with 3 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,8 +32,9 @@ Running: chmod +x MyScript.hx ./MyScript.hx For the included HaxeScript: haxelib install mcli chmod +x HaxeScript.hx ./HaxeScript.hx [yourname] --loud -
clarkjones revised this gist
Oct 7, 2015 . 2 changed files with 7 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,10 +1,11 @@ #!/usr/bin/env haxex -lib mcli @ /** Take from mcli example https://github.com/waneck/mcli Say hello. Example inspired by ruby's "executable" lib example **/ class HaxeScript extends mcli.CommandLine { /** Say it in uppercase? @@ -32,7 +33,7 @@ class HelloWorld extends mcli.CommandLine public static function main() { new mcli.Dispatch(Sys.args()).dispatch(new HaxeScript()); } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -32,9 +32,10 @@ Running: chmod +x MyScript.hx ./MyScript.hx For the included HaxeScript: haxelib install mcli chmod +x HaxeScript.hx ./HaxeScript.hx [yourname] --loud Pretty neat-o if you ask me. -
clarkjones revised this gist
Oct 7, 2015 . 1 changed file with 5 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -26,10 +26,15 @@ Usage: } } Running: chmod +x MyScript.hx ./MyScript.hx For the included HelloWorld chmod +x HelloWorld.hx ./HelloWorld.hx [yourname] --loud Pretty neat-o if you ask me. -
clarkjones revised this gist
Oct 7, 2015 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ **Note: This is modified version of the haxex script created by @jasononeil** **This version allows for specifying compiler args in your script. so you can include and use libraries like mcli** This is a tiny shell script that you can use to make scripting with Haxe very straight forward. -
clarkjones revised this gist
Oct 7, 2015 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,5 @@ **Note: This is modified version of the haxex script created by @jasononeil** **This version allows for specifying compiler args in your script. so you can include and use libraries like mcli** This is a tiny shell script that you can use to make scripting with Haxe very straight forward. -
clarkjones revised this gist
Oct 7, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,4 +1,4 @@ **Note: This is modified version of the haxex script created by @jasononeil* This is a tiny shell script that you can use to make scripting with Haxe very straight forward. -
clarkjones revised this gist
Oct 7, 2015 . 4 changed files with 59 additions and 28 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,38 @@ #!/usr/bin/env haxex -lib mcli @ /** Say hello. Example inspired by ruby's "executable" lib example **/ class HelloWorld extends mcli.CommandLine { /** Say it in uppercase? **/ public var loud:Bool; /** Show this message. **/ public function help() { Sys.println(this.showUsage()); Sys.exit(0); } public function runDefault(?name:String) { if(name == null) name = "World"; var msg = 'Hello, $name!'; if (loud) msg = msg.toUpperCase(); Sys.println(msg); } public static function main() { new mcli.Dispatch(Sys.args()).dispatch(new HelloWorld()); } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,26 @@ **Note: This is modified version of the haxex script created by Jason O'Neil** 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` and then use that. Installation: **if you're using OS X El Capitain you'll probably need to put haxex in /usr/local/bin/** 1. `sudo nano /usr/bin/haxex`, paste the 'haxex' file in there 2. `sudo chmod +x /usr/bin/haxex` Usage: #!/usr/bin/env haxex -debug @ class MyScript { public static function main() { trace('My Script is executing!'); #if debug trace('with debug flag!'); #end } } @@ -27,11 +33,13 @@ Pretty neat-o if you ask me. What this script actually does: 1. Replaces '@' with --run 2. Gets rid of "./" at the start of filename 3. Gets rid of the ".hx" at the end of filename 4. Turns the "/" dir separators into "." package separators, in case your script is in a subpackage. Limitations: Currently the first occurance of './' will be stripped and '/' will be replaced with '.' so avoiding using these symbols in your args is probably best for now If your script is in the root package (has no `package` statement at the top of the file), then you need to call it from the directory the script is in. If your script is in a sub-package, you need to call it from the root-level package. Easy rule of thumb: don't use packages, and call from the directory the script is in. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,15 +1,15 @@ #!/bin/bash args=${@:1} args=${args/@/" --run"} # Remove ".hx" if it's there args=${args/\.hx/""} # Remove "./" if it's there args=${args/\.\//""} # Change "/" to "." args=${args/\//"."} haxe $args -
jasononeil created this gist
Apr 22, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ #!/usr/bin/haxex // Run with "./HaxeScript.hx some args here" class HaxeScript { public static function main() { trace('Hi, the following ${Sys.args().length} arguments were passed in:'); for (a in Sys.args()) { trace (' $a'); } } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,37 @@ 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` and then use that. Installation: 1. `sudo nano /usr/bin/haxex`, paste the 'haxex' file in there 2. `sudo chmod +x /usr/bin/haxex` Usage: #!/usr/bin/haxex class MyScript { public static function main() { trace('My Script is executing!'); } } Running: chmod +x MyScript.hx ./MyScript.hx Pretty neat-o if you ask me. What this script actually does: 1. Reads the first argument as "filename" 2. Gets rid of the "./" at the start of $filename 3. Gets rid of the ".hx" at the end of $filename 4. Turns the "/" dir separators into "." package separators, in case your script is in a subpackage. Limitations: If your script is in the root package (has no `package` statement at the top of the file), then you need to call it from the directory the script is in. If your script is in a sub-package, you need to call it from the root-level package. Easy rule of thumb: don't use packages, and call from the directory the script is in. This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,15 @@ #!/bin/bash # First argument is the filename filename=$1 # Remove "./" if it's there filename=${filename/"./"/""} # Remove ".hx" if it's there filename=${filename/".hx"/""} # Change "/" to "." filename=${filename/"/"/"."} haxe --run $filename ${@:2}