Skip to main content
Skip to main content

AG009: Duplicate Short Alias

PropertyValue
CodeAG009
SeverityWarning
Sincev0.1.0

Description

Two or more entries in the same args=() array use the same single-character short alias. Only one will work at parse time.

The duplicate check is suppressed when both entries share the same field name and the :^ (inherited) modifier is involved, since the inherited field intentionally overrides the parent's definition.

Example

This triggers AG009:

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

How to Fix

Use unique short aliases for each flag:

my_func() {
local name
local domain
local -a args=(
'name|n' "The name"
'domain|d' "The domain"
)
:args "Test" "${@}"
}

How to Suppress

# argsh disable=AG009
'domain|n' "The domain"

Or file-wide:

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