Skip to content

Commit

Permalink
fix: make short/long exclusives
Browse files Browse the repository at this point in the history
  • Loading branch information
cristiand391 committed Jan 15, 2023
1 parent 9a6c85a commit bb5596a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/commands/autocomplete/create.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ compinit;\n`
const valueTemplate = ` "%s[%s]" \\\n`
const argTemplate = ` "%s")\n %s\n ;;\n`
const flagCompWithOptsTpl =
` %s"[%s]:%s options:(%s)" \\\n`
` "%s"%s"[%s]:%s options:(%s)" \\\n`

// TODO:
// * include command aliases
Expand Down Expand Up @@ -306,6 +306,7 @@ compinit;\n`
if (flag.char) {
flagsComp+=util.format(
flagCompWithOptsTpl,
`(-${flag.char} --${flag.name})`,
`{-${flag.char},--${flagName}}`,
sanitizeDescription(flag.summary ||flag.description),
flagName,
Expand All @@ -322,7 +323,7 @@ compinit;\n`
}
} else {
if (flag.char) {
flagsComp+=` {-${flag.char},--${flagName}}"[${sanitizeDescription(flag.summary ||flag.description)}]" \\\n`
flagsComp+=` "(-${flag.char} --${flag.name})"{-${flag.char},--${flagName}}"[${sanitizeDescription(flag.summary ||flag.description)}]" \\\n`
} else {
flagsComp+=` --${flagName}"[${sanitizeDescription(flag.summary || flag.description)}]" \\\n`
}
Expand Down

0 comments on commit bb5596a

Please sign in to comment.