refactor: improve templater formatting
This commit is contained in:
parent
1e4740a08f
commit
7e66668f98
@ -114,7 +114,7 @@ TEMP_FILE="$(mktemp)"
|
||||
|
||||
# Set the Contents directory to the env variable, script set, or to their .contents file in the user home
|
||||
CONTENTS_DIRECTORY="${CONTENTS_DIRECTORY:=\
|
||||
$(mkdir -p "${HOME}/.contents" && echo "${HOME}/.contents")}"
|
||||
$(mkdir -p "${HOME}/.contents" && echo "${HOME}/.contents")}"
|
||||
|
||||
EXIT_ON_ERROR=0
|
||||
|
||||
@ -380,37 +380,38 @@ usage() {
|
||||
# POSIX Compliant:
|
||||
# Yes
|
||||
#
|
||||
printf "Usage: %s\n" \
|
||||
"$(basename "${0}") [OPTIONS]
|
||||
$(arg_required "REQUIRED")
|
||||
$(arg_optional "OPTIONAL")
|
||||
cat <<EOF
|
||||
Usage: $(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
|
||||
$(arg_required "--template-file") <templateFile: string> | $(arg_required "-t") <templateFile: string>
|
||||
$(arg_description "A template file to parse and apply rules for
|
||||
|
||||
Example:
|
||||
--template-file example.tmpl")
|
||||
Example:
|
||||
--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.
|
||||
$(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\`
|
||||
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:
|
||||
--contents-dir ~/Desktop/contents")
|
||||
Example:
|
||||
--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
|
||||
$(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")
|
||||
Example:
|
||||
--output-to myfile.out")
|
||||
|
||||
$(arg_optional "--no-exit") | $(arg_optional "-n")
|
||||
$(arg_description "Do not exit on any errors, continue executing
|
||||
$(arg_optional "--no-exit") | $(arg_optional "-n")
|
||||
$(arg_description "Do not exit on any errors, continue executing
|
||||
|
||||
Example:
|
||||
--no-exit")"
|
||||
Example:
|
||||
--no-exit")
|
||||
EOF
|
||||
|
||||
}
|
||||
|
||||
@ -474,7 +475,7 @@ main() {
|
||||
shift
|
||||
done
|
||||
[[ -z "${template_file}" ]] &&
|
||||
log "error" "No template file provided, exiting" &&
|
||||
log "error" "No template file provided, exiting! Check \`-h\` for help." &&
|
||||
exit 1
|
||||
templater "${template_file}"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user