Skip to content

Commit 884c60f

Browse files
committed
Get list of commands from list files in commands directory
1 parent efd1cb4 commit 884c60f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

bash_completion

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,12 @@ __cppsm_complete() {
3232
CURRENT="${CURRENT%\"}"
3333
case "$PREVIOUS" in
3434
cppsm)
35-
# shellcheck disable=SC2207
36-
COMPREPLY=($(compgen -W "add build build-watch clone format init init-hello init-library list remove setup test test-watch update upgrade" -- "$CURRENT"))
35+
local COMMANDS_DIR
36+
COMMANDS_DIR="$(command -v cppsm)"
37+
COMMANDS_DIR="${COMMANDS_DIR%/*}/../commands"
38+
39+
# shellcheck disable=SC2207 disable=SC2035
40+
COMPREPLY=($(compgen -W "$(cd "$COMMANDS_DIR" && echo *)" -- "$CURRENT"))
3741
;;
3842
add)
3943
# shellcheck disable=SC2207

0 commit comments

Comments
 (0)