Remover requirement of passing args to help-line

This commit is contained in:
vlad 2021-12-21 11:19:51 -08:00
parent 4c54a238d8
commit b62ef700f4
4 changed files with 15 additions and 14 deletions

View File

@ -1,47 +1,47 @@
#!/usr/bin/env bash
hello() {
_help-line "Say hello!" "$@"
_help-line "Say hello!"
echo Hello, world!
}
build() {
_help-line "Build an incredible script" "$@"
_help-line "Build an incredible script"
mkdir -p .generated
echo 'echo hi; echo "$@"' > .generated/potato
chmod +x .generated/potato
}
run() {
_help-line "Run the script" "$@"
_help-line "Run the script"
build
.generated/potato "$@"
}
check() {
_help-line "Verify the script passes shellcheck" "$@"
_help-line "Verify the script passes shellcheck"
build
shellcheck .generated/potato
}
test() {
_help-line "Test output of the script" "$@"
_help-line "Test output of the script"
build
[ "$(.generated/potato)" == "hi" ]
}
clean() {
_help-line "Delete generated GARBAGE" "$@"
_help-line "Delete generated GARBAGE"
rm -rf .generated
}
good() {
_help-line "Show a nice message for something nice happening" "$@"
_help-line "Show a nice message for something nice happening"
_good-message + Good Message
}
bad() {
_help-line "Show a bad message for something bad happening" "$@"
_help-line "Show a bad message for something bad happening"
_bad-message - Bad Message
}
@ -64,7 +64,7 @@ kubectlw() {
}
⚡kubectl-version() {
_help-line "Show version of kubectl wrapper" "$@"
_help-line "Show version of kubectl wrapper"
kubectlw version
}

4
go
View File

@ -2,7 +2,7 @@
set -euo pipefail
⚡test() {
_help-line "Run all the tests" "$@"
_help-line "Run all the tests"
exit=0
for test in test/test*; do
bash $test || exit=1
@ -11,7 +11,7 @@ set -euo pipefail
}
deploy() {
_help-line "Publish ⚡️" "$@"
_help-line "Publish ⚡️"
scp ⚡ v@commandcenter.ofvlad.xyz:/srv/http/apps.ofvlad.xyz/⚡
}

View File

@ -59,7 +59,7 @@ testHelpLinesFromDefinedCommandsAreShown() {
#!/usr/bin/env bash
⚡hello() {
_help-line "Say Hello" "$@"
_help-line "Say Hello"
echo "Hello, World!" ;
}
' > go

5
View File

@ -24,7 +24,8 @@ redefine-functions-defined-with-selector-16() {
}
⚡help() {
_help-line "Show this list" "$@"
_help-line "Show this list"
export HELP_LINE=please
echo Usage: "$0" SUBCOMMAND
echo
echo "Available subcommands:"
@ -47,7 +48,7 @@ _subcommands() {
}
_help-line() {
if [[ "$#" == 2 && "$2" == "help-line" ]]; then
if [[ "${HELP_LINE:-}" == "please" ]]; then
echo "$1" && exit 0
fi
}