Last active
December 11, 2015 03:48
-
-
Save hawx/4540015 to your computer and use it in GitHub Desktop.
Shows an example of an external "img" script. Note the flags; --usage, --short and --long which are required. img will forward any calls to 'img testing' with the given arguments. It will also display formatted help for `img help testing`, `img testing -h` and `img testing --help`, and list the `testing` command in a section of `img help`.
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 characters
#!/usr/bin/env sh | |
# Needs to be on $PATH as "img-testing". | |
function usage { | |
echo "testing [args]" | |
} | |
function short { | |
echo "A script to test external img scripts." | |
} | |
function long { | |
echo " Testing is purely designed for testing img's external scripting | |
capabilites. It has no other use or purpose. | |
--hello # Says hello before doing anything" | |
} | |
case "$1" in | |
--usage ) usage | |
exit | |
;; | |
--short ) short | |
exit | |
;; | |
--long ) long | |
exit | |
;; | |
--hello ) echo "Hello!" | |
;; | |
esac | |
echo "Running" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment