Last active
February 9, 2017 00:34
-
-
Save gubi/7ce02b0a3470a7abb5d4c6f0e4193892 to your computer and use it in GitHub Desktop.
This file contains 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 characters
[ | |
{ | |
"name": "command", | |
"short": "c", | |
"type": "boolean", | |
"description": "Show this help", | |
"example": "'myapp --command=true|false' or 'myapp -c true|false'" | |
}, | |
... | |
] |
from http://unix.stackexchange.com/questions/162134/how-to-execute-a-bash-script-without-typing
You need add directory with your script to the PATH variable:
export PATH=$PATH:/path/to/diror you can even add current directory to the PATH:
export PATH=$PATH:.The later has some security drawback though.
If you want that the file will be parsed as well you need to place this header in the first line:
#!/usr/bin/env node
Include the argv module and the colors module:
var ARGV = require("argv"),
colors = require("colors");
then you can configure args in an external json file:
**
* Parse args in command line
*/
ARGS = ARGV.option(JSON.parse(
FS.readFileSync(C_.adjustPath("argv.json"), "utf8")
)).version("v1.0").run();
Consider also the readline module to build a quiz for variables if not provided
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment