Use case instead of several if statements
This commit is contained in:
parent
681ea21dd0
commit
6d30006368
19
qsgen2
19
qsgen2
@ -70,17 +70,26 @@ include common/colors
|
|||||||
|
|
||||||
echo "${magenta}${QSGEN} ${VERSION}${end}"
|
echo "${magenta}${QSGEN} ${VERSION}${end}"
|
||||||
|
|
||||||
if [[ ${1} == "version" ]] || [[ ${1} == "-v" ]] || [[ ${1} == "--version" ]]; then
|
function _version() {
|
||||||
echo "${yellow}- Created by kekePower - 2018-2024${end}"
|
echo "${yellow}- Created by kekePower - 2018-$(date +%Y)${end}"
|
||||||
echo "${yellow}- https://github.com/kekePower/qsgen2/${end}"
|
echo "${yellow}- https://github.com/kekePower/qsgen2/${end}"
|
||||||
echo "${yellow}- See '${0:t} help' for more information."
|
echo "${yellow}- See '${0:t} help' for more information."
|
||||||
exit
|
exit
|
||||||
fi
|
}
|
||||||
|
|
||||||
if [[ ${1} == "help" ]]; then
|
function _help() {
|
||||||
echo "This is where I'll write the Help documentation."
|
echo "This is where I'll write the Help documentation."
|
||||||
exit
|
exit
|
||||||
fi
|
}
|
||||||
|
|
||||||
|
case ${1} in
|
||||||
|
version || -v || --version)
|
||||||
|
_version
|
||||||
|
;;
|
||||||
|
help || -h || --help)
|
||||||
|
_help
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Loading Zsh modules
|
# Loading Zsh modules
|
||||||
zmodload zsh/files
|
zmodload zsh/files
|
||||||
|
Loading…
Reference in New Issue
Block a user