Skip to main content
Skip to main content

AG006: Usage Declared but :usage Never Called

PropertyValue
CodeAG006
SeverityError
Sincev0.1.0

Description

A function declares a usage=() array but never calls :usage to dispatch subcommands. The array declaration has no effect without the parse call.

Example

This triggers AG006:

main() {
local -a usage=(
"deploy" "Deploy the app"
"status" "Show status"
)
# missing: :usage "My CLI" "${@}"
}

How to Fix

Add a call to :usage:

main() {
local -a usage=(
"deploy" "Deploy the app"
"status" "Show status"
)
:usage "My CLI" "${@}"
}

How to Suppress

# argsh disable=AG006
main() {

Or file-wide:

# argsh disable-file=AG006
Was this section helpful?