cht-conf 4.6.0 → 4.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/README.md +5 -0
- package/package.json +1 -1
- package/src/cli/shell-completion-setup.js +1 -1
- package/src/cli/shell-completion.zsh +26 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [4.7.0](https://github.com/medic/cht-conf/compare/v4.6.0...v4.7.0) (2025-04-25)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **#683:** add autocompletion feature for zsh ([#684](https://github.com/medic/cht-conf/issues/684)) ([356f2e8](https://github.com/medic/cht-conf/commit/356f2e8c25fa42e26d53e2d6df3be85da1bda704)), closes [#683](https://github.com/medic/cht-conf/issues/683)
|
|
7
|
+
|
|
1
8
|
# [4.6.0](https://github.com/medic/cht-conf/compare/v4.5.0...v4.6.0) (2025-04-23)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -68,6 +68,11 @@ To enable tab completion in bash, add the following to your `.bashrc`/`.bash_pro
|
|
|
68
68
|
|
|
69
69
|
eval "$(cht --shell-completion=bash)"
|
|
70
70
|
|
|
71
|
+
## Zsh completion
|
|
72
|
+
To enable tab completion in zsh, add the following to your `~/.zshrc` file:
|
|
73
|
+
|
|
74
|
+
eval "$(cht --shell-completion=zsh)"
|
|
75
|
+
|
|
71
76
|
## Upgrading
|
|
72
77
|
|
|
73
78
|
To upgrade to the latest version
|
package/package.json
CHANGED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#compdef cht
|
|
2
|
+
|
|
3
|
+
_cht() {
|
|
4
|
+
local curcontext="$curcontext" state line
|
|
5
|
+
typeset -A opt_args
|
|
6
|
+
|
|
7
|
+
# Get the current word being completed
|
|
8
|
+
local current_word="${words[CURRENT]}"
|
|
9
|
+
local current_pos=$CURRENT
|
|
10
|
+
|
|
11
|
+
# Call the shell-completion-for-cht program to get available options
|
|
12
|
+
# current_pos - 1 gives the index of the previous word, which is typically the argument it is the word just before the current word
|
|
13
|
+
# previous_word helps in setting correct context for the completion
|
|
14
|
+
|
|
15
|
+
local completion_options
|
|
16
|
+
completion_options=$(shell-completion-for-cht $((current_pos-1)) "$current_word")
|
|
17
|
+
|
|
18
|
+
# Split the output by spaces into an array
|
|
19
|
+
local -a completion_array
|
|
20
|
+
completion_array=(${=completion_options})
|
|
21
|
+
|
|
22
|
+
# Provide completions
|
|
23
|
+
compadd -a completion_array
|
|
24
|
+
}
|
|
25
|
+
#Register the completion function
|
|
26
|
+
compdef _cht cht
|