summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--step-cli/PKGBUILD32
-rw-r--r--step-cli/bash_autocomplete21
-rw-r--r--step-cli/zsh_autocomplete13
3 files changed, 66 insertions, 0 deletions
diff --git a/step-cli/PKGBUILD b/step-cli/PKGBUILD
new file mode 100644
index 000000000..8f6e35475
--- /dev/null
+++ b/step-cli/PKGBUILD
@@ -0,0 +1,32 @@
+# Maintainer: Erich Eckner <arch at eckner dot net>
+pkgname=step-cli
+pkgver=0.14.4
+pkgrel=1
+pkgdesc="An online certificate authority and related tools for secure automated certificate management, so you can use TLS everywhere."
+arch=('i486' 'i686' 'pentium4' 'x86_64' 'armv6h' 'armv7h' 'aarch64')
+makedepends=(go golangci-lint)
+url="https://smallstep.com/certificates"
+license=('Apache')
+
+source=("${pkgname}-${pkgver}.tar.gz::https://github.com/smallstep/cli/archive/v${pkgver}.tar.gz"
+ "https://github.com/smallstep/cli/raw/v${pkgver}/autocomplete/bash_autocomplete"
+ "https://github.com/smallstep/cli/raw/v${pkgver}/autocomplete/zsh_autocomplete")
+sha512sums=('2f7420bb3a9c90110534b402e6446e20dcdf239a9dbe198586ae894487db33cd06a673139393cfac02d7999f2f0fa8fb3204a2707119260119c2b948721ab191'
+ 'a18b7685349e54d59ca247adcac4dc95444b14352c142230df39afa651c39831c55a3dcdd8e555154e3859db835284db0e1c12cf5779bb6b2d71c9f15648f73f'
+ 'f507da7b7aad35d62a4df8ffcb6da3ac17f2424e9d6709d8688084de5ebb30b47e0b30fe7922fbb9747fbc2e54c282a26baadbd12c8cb89d747daec069be6b51')
+
+prepare() {
+ sed -i "s/step/${pkgname}/g" "zsh_autocomplete"
+}
+
+build() {
+ cd cli-$pkgver
+ make -j 1
+}
+
+package() {
+ install -Dm755 "cli-$pkgver/bin/step" "$pkgdir/usr/bin/$pkgname"
+ install -Dm644 "cli-$pkgver/README.md" "$pkgdir/usr/share/doc/$pkgname/README.md"
+ install -Dm644 "bash_autocomplete" "$pkgdir/usr/share/bash-completion/completions/${pkgname}"
+ install -Dm644 "zsh_autocomplete" "$pkgdir/usr/share/zsh/site-functions/_${pkgname}"
+}
diff --git a/step-cli/bash_autocomplete b/step-cli/bash_autocomplete
new file mode 100644
index 000000000..d30588089
--- /dev/null
+++ b/step-cli/bash_autocomplete
@@ -0,0 +1,21 @@
+#! /bin/bash
+
+: ${PROG:=$(basename ${BASH_SOURCE})}
+
+_cli_bash_autocomplete() {
+ local cur opts base
+ COMPREPLY=()
+ cur="${COMP_WORDS[COMP_CWORD]}"
+ opts=$( ${COMP_WORDS[@]:0:$COMP_CWORD} --generate-bash-completion )
+ if [ -n "${opts}" ];
+ then
+ COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+ else
+ _filedir
+ fi
+ return 0
+}
+
+complete -F _cli_bash_autocomplete $PROG
+
+unset PROG
diff --git a/step-cli/zsh_autocomplete b/step-cli/zsh_autocomplete
new file mode 100644
index 000000000..ffb9f9bea
--- /dev/null
+++ b/step-cli/zsh_autocomplete
@@ -0,0 +1,13 @@
+#compdef step
+
+function _step {
+ local -a opts
+ opts=("${(@f)$(_CLI_ZSH_AUTOCOMPLETE_HACK=1 ${words[@]:0:#words[@]-1} --generate-bash-completion)}")
+ if [[ "${opts}" != "" ]]; then
+ _describe -t step-commands 'values' opts
+ else
+ _path_files
+ fi
+}
+
+_step "$@"