cht-conf 4.6.0 → 4.8.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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [4.8.0](https://github.com/medic/cht-conf/compare/v4.7.0...v4.8.0) (2025-04-25)
2
+
3
+
4
+ ### Features
5
+
6
+ * **#685:** added PR title linting workflow in GitHub CI ([#686](https://github.com/medic/cht-conf/issues/686)) ([c2d42f6](https://github.com/medic/cht-conf/commit/c2d42f60adb39584ee5c7eb861aa38d7d8df8498)), closes [#685](https://github.com/medic/cht-conf/issues/685)
7
+
8
+ # [4.7.0](https://github.com/medic/cht-conf/compare/v4.6.0...v4.7.0) (2025-04-25)
9
+
10
+
11
+ ### Features
12
+
13
+ * **#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)
14
+
1
15
  # [4.6.0](https://github.com/medic/cht-conf/compare/v4.5.0...v4.6.0) (2025-04-23)
2
16
 
3
17
 
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cht-conf",
3
- "version": "4.6.0",
3
+ "version": "4.8.0",
4
4
  "description": "Configure CHT deployments",
5
5
  "main": "./src/lib/main.js",
6
6
  "engines": {
@@ -1,6 +1,6 @@
1
1
  const fs = require('../lib/sync-fs');
2
2
 
3
- const SUPPORTED_SHELLS = ['bash'];
3
+ const SUPPORTED_SHELLS = ['bash','zsh'];
4
4
 
5
5
  module.exports = shell => {
6
6
  if (SUPPORTED_SHELLS.includes(shell)){
@@ -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