]> git.sur5r.net Git - tio/blobdiff - src/bash-completion/tio.in
New upstream version 1.34
[tio] / src / bash-completion / tio.in
index a0d062de286320b788286e262a8645355e8fc319..2457f755027e35a27be0fb5aeb32b52607f4730c 100644 (file)
@@ -4,7 +4,7 @@
 
 _tio()
 {
-    local cur prev opts base
+    local cur prev opts base ttys
     COMPREPLY=()
     cur="${COMP_WORDS[COMP_CWORD]}"
     prev="${COMP_WORDS[COMP_CWORD-1]}"
@@ -20,12 +20,15 @@ _tio()
           -l --log \
           -m --map \
           -v --version \
+          -t --timestamp \
+          -L --list-devices \
+          -c --color \
           -h --help"
 
     #  Complete the arguments to the options.
     case "${prev}" in
         -b | --baudrate)
-            local baudrates="@BAUDRATES@"
+            local baudrates="@baudrates@"
             COMPREPLY=( $(compgen -W "$baudrates" -- ${cur}) )
             return 0
             ;;
@@ -65,6 +68,18 @@ _tio()
             COMPREPLY=( $(compgen -W "ICRNL IGNCR INLCR INLCRNL OCRNL ODELBS ONLCRNL" -- ${cur}) )
             return 0
             ;;
+        -t | --timestamp)
+            COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+            return 0
+            ;;
+        -L | --list-devices)
+            COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
+            return 0
+            ;;
+        -c | --color)
+            COMPREPLY=( $(compgen -W "$(seq 0 255)" -- ${cur}) )
+            return 0
+            ;;
         -v | --version)
             COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
             return 0
@@ -76,9 +91,20 @@ _tio()
         *)
         ;;
     esac
+    case "${cur}" in
+        -*)
+            COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
+            return 0
+            ;;
+    esac
 
-   COMPREPLY=($(compgen -W "${opts}" -- ${cur}))
-   return 0
+    if [ -d /dev/serial/by-id ]; then
+        ttys=$(printf '%s\n' /dev/tty* /dev/serial/by-id/*)
+    else
+        ttys=$(printf '%s\n' /dev/tty*)
+    fi
+    COMPREPLY=( $(compgen -W "${ttys}" -- ${cur}) )
+    return 0
 }
 
 # Bind completion to tio command