aboutsummaryrefslogtreecommitdiff
path: root/2018-linuxdays/examples/bash/switch
diff options
context:
space:
mode:
Diffstat (limited to '2018-linuxdays/examples/bash/switch')
-rw-r--r--2018-linuxdays/examples/bash/switch16
1 files changed, 16 insertions, 0 deletions
diff --git a/2018-linuxdays/examples/bash/switch b/2018-linuxdays/examples/bash/switch
new file mode 100644
index 0000000..db55dd7
--- /dev/null
+++ b/2018-linuxdays/examples/bash/switch
@@ -0,0 +1,16 @@
+_sterm() {
+ local cur prev words cword
+ _init_completion || return
+ case "$prev" in
+ -b|-d|-r)
+ # No completion for these
+ ;;
+ -s)
+ COMPREPLY=($(compgen -W "9600 19200 38400 57600 115200" -- ${cur}))
+ ;;
+ *)
+ COMPREPLY=($(compgen -W "-s -b -d -r" -- ${cur}))
+ ;;
+ esac
+}
+complete -o default -F _sterm sterm