aboutsummaryrefslogtreecommitdiff
path: root/2018-linuxdays/examples/bash
diff options
context:
space:
mode:
Diffstat (limited to '2018-linuxdays/examples/bash')
-rw-r--r--2018-linuxdays/examples/bash/function4
-rw-r--r--2018-linuxdays/examples/bash/mupdf-pdf1
-rw-r--r--2018-linuxdays/examples/bash/real23
-rw-r--r--2018-linuxdays/examples/bash/simple1
-rw-r--r--2018-linuxdays/examples/bash/switch16
5 files changed, 45 insertions, 0 deletions
diff --git a/2018-linuxdays/examples/bash/function b/2018-linuxdays/examples/bash/function
new file mode 100644
index 0000000..ab6e5da
--- /dev/null
+++ b/2018-linuxdays/examples/bash/function
@@ -0,0 +1,4 @@
+_sterm() {
+ COMPREPLY+=($(compgen -W "9600 19200 38400 57600 115200" -- "${COMP_WORDS[COMP_CWORD]}"))
+}
+complete -F _sterm sterm
diff --git a/2018-linuxdays/examples/bash/mupdf-pdf b/2018-linuxdays/examples/bash/mupdf-pdf
new file mode 100644
index 0000000..3f5c250
--- /dev/null
+++ b/2018-linuxdays/examples/bash/mupdf-pdf
@@ -0,0 +1 @@
+complete -G \*.pdf mupdf
diff --git a/2018-linuxdays/examples/bash/real b/2018-linuxdays/examples/bash/real
new file mode 100644
index 0000000..2dd3f36
--- /dev/null
+++ b/2018-linuxdays/examples/bash/real
@@ -0,0 +1,23 @@
+# Bash completion file for sterm
+# vim: ft=sh
+
+_sterm() {
+ local cur prev words cword
+ _init_completion || return
+ local ops="-h --help -c -d -e -n -r -s -v"
+ case "$prev" in
+ -b|-d|-r)
+ # No completion for these
+ ;;
+ -s)
+ local speeds="0 50 75 110 134 150 200 300 600 1200 1800 2400 4800 9600 19200 38400 57600 115200 230400"
+ COMPREPLY+=($(compgen -W "${speeds}" -- ${cur}))
+ ;;
+ *)
+ COMPREPLY+=($(compgen -W "${ops}" -- ${cur}))
+ COMPREPLY+=($(compgen -G "/dev/tty*" -- ${cur}))
+ ;;
+ esac
+}
+
+complete -o default -F _sterm sterm
diff --git a/2018-linuxdays/examples/bash/simple b/2018-linuxdays/examples/bash/simple
new file mode 100644
index 0000000..76b8813
--- /dev/null
+++ b/2018-linuxdays/examples/bash/simple
@@ -0,0 +1 @@
+complete -W "9600 19200 38400 57600 115200" sterm
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