Added help menu
This commit is contained in:
parent
b842e7c4f6
commit
197e637da1
@ -3,9 +3,15 @@
|
||||
# "Import" our needed functions from our library
|
||||
LIBRARY_PATH="/usr/local/lib/Custom-Scripts"
|
||||
# shellcheck source=/usr/local/lib/
|
||||
source "${LIBRARY_PATH}/Logging-RGB.bash" || echo "Unable to source Logging-RGB.bash at ${LIBRARY_PATH}"
|
||||
if ! source "${LIBRARY_PATH}/Logging-RGB.bash"; then
|
||||
echo "Unable to source Logging-RGB.bash at ${LIBRARY_PATH}"
|
||||
exit 1
|
||||
fi
|
||||
# shellcheck source=/usr/local/lib/
|
||||
source "${LIBRARY_PATH}/Trim.bash" || log "error" "Unable to source Trim.bash at ${LIBRARY_PATH}"
|
||||
if ! source "${LIBRARY_PATH}/Trim.bash"; then
|
||||
log "error" "Unable to source Trim.bash at ${LIBRARY_PATH}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Tmp file used because most distros have this dir exist in RAM, use PID of our process to write to
|
||||
TEMP_FILE="/tmp/$$"
|
||||
@ -237,6 +243,18 @@ templater() {
|
||||
fi
|
||||
}
|
||||
|
||||
arg_required() {
|
||||
echo_rgb "${1}" 255 183 0
|
||||
}
|
||||
|
||||
arg_optional(){
|
||||
echo_rgb "${1}" 117 255 255
|
||||
}
|
||||
|
||||
arg_description(){
|
||||
echo_rgb "${@}" 220 190 255
|
||||
}
|
||||
|
||||
usage() {
|
||||
# Print out usage instructions for the local script
|
||||
#
|
||||
@ -250,13 +268,37 @@ usage() {
|
||||
# Yes
|
||||
#
|
||||
printf "Usage: %s\n" \
|
||||
"$(basename ${0}) -i \"this is some input\" -t \"this is some more example input\"
|
||||
--input <string> | -i <string>
|
||||
"$(basename ${0}) [OPTIONS]
|
||||
$(arg_required "REQUIRED")
|
||||
$(arg_optional "OPTIONAL")
|
||||
|
||||
$(arg_required "--template-file") <templateFile: string> | $(arg_required "-t") <templateFile: string>
|
||||
$(arg_description "A template file to parse and apply rules for
|
||||
|
||||
Example:
|
||||
--input \"this is an example input\"
|
||||
--test <string> | -t <string>
|
||||
--template-file example.tmpl")
|
||||
|
||||
$(arg_optional "--contents-dir") <contentsDirectory: string> | $(arg_optional "-c") <contentsDirectory: string>
|
||||
$(arg_description "The files that contain contents read by the templates.
|
||||
|
||||
By default this is set to ~/.contents/ if unset, to set via variable you can either use this argument or pass
|
||||
export CONTENTS_DIRECTORY=\`your contents directory\`
|
||||
|
||||
Example:
|
||||
--test \"this is more example input\""
|
||||
--contents-dir ~/Desktop/contents")
|
||||
|
||||
$(arg_optional "--output-to") <outputFile: string> | $(arg_optional "-o") <outputFile: string>
|
||||
$(arg_description "The file to output the applied template to, this can be set within a template, but can be overriden with this option
|
||||
|
||||
Example:
|
||||
--output-to myfile.out")
|
||||
|
||||
$(arg_optional "--no-exit") | $(arg_optional "-n")
|
||||
$(arg_description "Do not exit on any errors, continue executing
|
||||
|
||||
Example:
|
||||
--no-exit")"
|
||||
|
||||
}
|
||||
|
||||
main() {
|
||||
|
Loading…
Reference in New Issue
Block a user