diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 54d0e2a..06eeb1a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -11,9 +11,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Run shellcheck - run: | - find . -type f -name "*.sh" -exec shellcheck {} \; + - name: Run ShellCheck + uses: ludeeus/action-shellcheck@master + with: + format: tty + severity: style test: runs-on: ubuntu-latest steps: diff --git a/cli.sh b/cli.sh index 1571935..26cbe15 100755 --- a/cli.sh +++ b/cli.sh @@ -4,8 +4,8 @@ set -u # Simple CLI wrapper that discovers scripts in the commands/ directory # Cd to the directory of this script, so it can be run from anywhere -realpath="$(realpath "$0")" -cd "${realpath%/*}" +realpath="$(realpath "$0")" || { echo "Failed to get realpath"; exit 1; } +cd "${realpath%/*}" || { echo "Failed to cd to script directory"; exit 1; } #################### # Helper functions # @@ -14,21 +14,21 @@ cd "${realpath%/*}" # Prints a warning message without exiting. # Usage: warning ... warning() { - local msg="$@" + local msg="$*" printf "\e[43m\e[30m[warning]\e[0m %s\n" "$msg" } # Prints a error message without exiting. # Usage: error ... error() { - local msg="$@" + local msg="$*" printf "\e[41m\e[39m[error] %s\e[0m\n" "$msg" } # Prints a success message without exiting. -# Usage: error ... +# Usage: success ... success() { - local msg="$@" + local msg="$*" printf "\e[42m\e[30m[success]\e[0m %s\n" "$msg" }