Skip to content

Commit 29e29d8

Browse files
hick209ajalt
andauthored
[completion] Fixed autocomplete issue when using aliases (#500)
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>
1 parent 9a87ccf commit 29e29d8

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- 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))
77

88
### Fixed
9+
- Fixed `unrecognized modifier 'i'` that happened on tab-completion when using sub command aliases ([#500](https://github.com/ajalt/clikt/pull/500))
910
- 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))
1011

1112
## 4.2.2

clikt/src/commonMain/kotlin/com/github/ajalt/clikt/completion/BashCompletionGenerator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ internal object BashCompletionGenerator {
137137
"""
138138
| $name)
139139
| (( i = i + 1 ))
140-
| COMP_WORDS=( "${'$'}{COMP_WORDS[@]:0:i}"
140+
| COMP_WORDS=( "${'$'}{COMP_WORDS[@]:0:${'$'}{i}}"
141141
""".trimMargin()
142142
)
143143
toks.joinTo(this, " ", prefix = " ") { "'$it'" }

0 commit comments

Comments
 (0)