aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Tom Willemse2014-09-27 00:17:41 +0200
committerGravatar Tom Willemse2014-09-27 00:17:41 +0200
commit160476143bba2009d86f8b3e1033ee51e5dc897e (patch)
tree7809c2591183c460d78121207baabb3cc74ca865
parentbfc51dc982043f27583875c453cc9e0f37f002ce (diff)
parent8d9428d2376e295e885096e93a2dc4429cd30d26 (diff)
downloadsti-160476143bba2009d86f8b3e1033ee51e5dc897e.tar.gz
sti-160476143bba2009d86f8b3e1033ee51e5dc897e.zip
Merge remote-tracking branch 'babab/zsh-comp'
-rw-r--r--README.org2
-rw-r--r--zsh/_sti56
2 files changed, 57 insertions, 1 deletions
diff --git a/README.org b/README.org
index cfbf69e..470f1e0 100644
--- a/README.org
+++ b/README.org
@@ -3,7 +3,7 @@
#+HTML_HEAD: <link type="text/css" rel="stylesheet" href="https://ryuslash.org/org.css" />
~sti~ is a simplistic tool installer written in Bash. It offers simple
-commands to help installing little tools your or otherss have written.
+commands to help installing little tools you or others have written.
This document will try to explain to you how to use it.
Bug reports, feature requests, asking for help, and such things can be
diff --git a/zsh/_sti b/zsh/_sti
new file mode 100644
index 0000000..637d987
--- /dev/null
+++ b/zsh/_sti
@@ -0,0 +1,56 @@
+#compdef sti
+# sti --- Stupid Tool Installer
+# Copyright (C) 2014 Tom Willemse <tom@ryuslash.org>
+
+# sti is free software: you can redistribute it and/or modify it under
+# the terms of the GNU General Public License as published by the Free
+# Software Foundation, either version 3 of the License, or (at your
+# option) any later version.
+
+# sti is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
+# License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with sti. If not, see <http://www.gnu.org/licenses/>.
+
+local expl
+local -a sti_tools _sti_commands
+
+get_tools() {
+ if [[ "$state" == tools ]]; then
+ sti_tools=(${(f)"$(_call_program sti_tools \
+ sti list | awk '{ print $1 }' 2>/dev/null)"})
+ _wanted sti_tools expl 'enabled tools' compadd -a sti_tools
+ fi
+}
+
+_sti_commands=(
+ 'help:show help message'
+ 'install:install a tool from a git repository'
+ 'list:list downloaded tools'
+ 'reinit:retry installing the executables of a tool'
+ 'remove:remove an installed tool'
+ 'update:update an installed tool'
+)
+
+_arguments '*:: :->subcmds' && return 0
+
+if (( CURRENT == 1 )); then
+ _describe -t commands "sti command" _sti_commands
+ return
+fi
+
+case "$words[1]" in
+ h*)
+ _describe -t commands "sti subcommands" _sti_commands
+ return 0 ;;
+ i* | l* )
+ _arguments && return 0 ;;
+ r* | u*)
+ _arguments '*:: :->tools' && return 0
+ get_tools ;;
+esac
+
+# vim: set ft=zsh et ts=2 sw=2 sts=2: