Skip to main content
Skip to main content

AG003: Invalid Field Specification

PropertyValue
CodeAG003
SeverityError
Sincev0.1.0

Description

The field spec string in the args=() array could not be parsed. This usually means an unknown modifier, malformed syntax, or an invalid combination of modifiers in the spec.

The diagnostic message includes the specific parse error for the spec.

Example

This triggers AG003:

my_func() {
local name
local -a args=(
'name|n|INVALID' "The name"
)
:args "My function" "${@}"
}

How to Fix

Correct the field spec to use valid syntax. The general format is:

'<name>|<short>[<modifiers>]' "Description"

Valid modifiers include ! (required), + (multi-value), = (key-value), :^ (inherited), :! (flags-only), among others.

my_func() {
local name
local -a args=(
'name|n' "The name"
)
:args "My function" "${@}"
}

See the Command Line Parser documentation for the full field spec syntax.

How to Suppress

# argsh disable=AG003
'name|n|INVALID' "The name"

Or file-wide:

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