Skip to content

Commit 43657ca

Browse files
authored
Add option to install circlci-cli completions. (#3)
Forcefully installs bash completions at /etc/bash_completion.d/circleci. Gracefully installs zsh completions at /usr/share/zsh/vendor-completions/_circleci.
1 parent 21b2399 commit 43657ca

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

src/circleci-cli/devcontainer-feature.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,11 @@
1313
"default": "/usr/local/bin/",
1414
"description": "Filesystem location of the circleci binary.",
1515
"type": "string"
16+
},
17+
"completions": {
18+
"default": true,
19+
"description": "Attempt to install shell completions for bash & zsh.",
20+
"type": "boolean"
1621
}
1722
},
1823
"customizations": {

src/circleci-cli/install.sh

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,17 @@ check_packages() {
2727
}
2828

2929
export DEBIAN_FRONTEND=noninteractive
30-
check_packages curl ca-certificates
30+
check_packages curl ca-certificates bash-completion
3131

3232
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | bash
33+
34+
if [ "$COMPLETIONS" = "true" ]; then {
35+
# circleci bash completion
36+
mkdir -p /etc/bash_completion.d
37+
circleci completion bash > /etc/bash_completion.d/circleci
38+
39+
# circleci zsh completion
40+
if [ -e "/usr/share/zsh/vendor-completions" ]; then
41+
circleci completion zsh > /usr/share/zsh/vendor-completions/_circleci
42+
fi
43+
} fi

0 commit comments

Comments
 (0)