Skip to content

Commit

Permalink
[completion] Fixed autocomplete issue when using aliases (#500)
Browse files Browse the repository at this point in the history
Right now if we try to use tab-complete with an alias, we get the following error (reproduced on a macOS and zsh):

   unrecognized modifier `i'

---------

Co-authored-by: AJ Alt <ajalt@users.noreply.github.com>
  • Loading branch information
hick209 and ajalt committed Mar 22, 2024
1 parent 9a87ccf commit 29e29d8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -6,6 +6,7 @@
- Added `Context.registerClosable` and `Context.callOnClose` to allow you to register cleanup actions that will be called when the command exits. ([#395](https://github.com/ajalt/clikt/issues/395))

### Fixed
- Fixed `unrecognized modifier 'i'` that happened on tab-completion when using sub command aliases ([#500](https://github.com/ajalt/clikt/pull/500))
- Make sure auto complete script works on zsh, fixing the error `complete:13: command not found: compdef` ([#499](https://github.com/ajalt/clikt/pull/499))

## 4.2.2
Expand Down
Expand Up @@ -137,7 +137,7 @@ internal object BashCompletionGenerator {
"""
| $name)
| (( i = i + 1 ))
| COMP_WORDS=( "${'$'}{COMP_WORDS[@]:0:i}"
| COMP_WORDS=( "${'$'}{COMP_WORDS[@]:0:${'$'}{i}}"
""".trimMargin()
)
toks.joinTo(this, " ", prefix = " ") { "'$it'" }
Expand Down

0 comments on commit 29e29d8

Please sign in to comment.