mirror of https://github.com/Calamitous/iris.git
First attempt at bash and zsh completions
This commit is contained in:
parent
d744eb023d
commit
4da59d6230
|
@ -0,0 +1,41 @@
|
||||||
|
#!/bin/bash -eu
|
||||||
|
|
||||||
|
# This is a bash completion script for iris
|
||||||
|
# It should be copied to /usr/share/bash-completion/completions/iris
|
||||||
|
|
||||||
|
_iris_module() {
|
||||||
|
local cur prev OPTS
|
||||||
|
COMPREPLY=()
|
||||||
|
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||||
|
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||||
|
|
||||||
|
case $prev in
|
||||||
|
-f | --test-file)
|
||||||
|
return 0 # File
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
case $cur in
|
||||||
|
--*)
|
||||||
|
OPTS="--help
|
||||||
|
--version
|
||||||
|
--stats
|
||||||
|
--interactive
|
||||||
|
--dump
|
||||||
|
--test-file
|
||||||
|
--debug"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
OPTS="-h
|
||||||
|
-v
|
||||||
|
-s
|
||||||
|
-i
|
||||||
|
-d
|
||||||
|
-f"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
COMPREPLY=( $(compgen -W "${OPTS[*]}" -- $cur) )
|
||||||
|
}
|
||||||
|
|
||||||
|
complete -F _iris_module -o bashdefault -o default iris
|
|
@ -0,0 +1,28 @@
|
||||||
|
#compdef _iris iris
|
||||||
|
|
||||||
|
# This is a zsh completion script for iris
|
||||||
|
# It should be copied to /usr/share/zsh/functions/Completion/Unix/_iris
|
||||||
|
|
||||||
|
function _iris {
|
||||||
|
local context state state_descr line
|
||||||
|
typeset -A opt_args
|
||||||
|
|
||||||
|
_arguments -C \
|
||||||
|
"-h[Show help information]" \
|
||||||
|
"--help[Show help information]" \
|
||||||
|
"-v[Display the current version of Iris]" \
|
||||||
|
"--version[Display the current version of Iris]" \
|
||||||
|
"-s[Display Iris version and message stats]" \
|
||||||
|
"--stats[Display Iris version and message stats]" \
|
||||||
|
"-i[Enter interactive mode (default)]" \
|
||||||
|
"--interactive[Enter interactive mode (default)]" \
|
||||||
|
"-d[Dump entire message corpus out]" \
|
||||||
|
"--dump[Dump entire message corpus out]" \
|
||||||
|
"-f[Use the specified test file for messages]:f:->f" \
|
||||||
|
"--test-file[Use the specified test file for messages]:f:->f" \
|
||||||
|
"--debug[Print warnings and debug informtation during use]"
|
||||||
|
|
||||||
|
if [ "$state" = "f" ]; then
|
||||||
|
_files
|
||||||
|
fi
|
||||||
|
}
|
Loading…
Reference in New Issue