diff options
author | Tom Ryder <tom@sanctum.geek.nz> | 2015-10-21 13:54:30 +1300 |
---|---|---|
committer | Tom Ryder <tom@sanctum.geek.nz> | 2015-10-21 13:54:30 +1300 |
commit | 5bfebd765f1de0bf662e1c7ea75533971e8e502f (patch) | |
tree | 34571eb06abc23e11d6633197bfe2828891106a5 /bash/bashrc.d | |
parent | Tidy up completion considerably; no more compgen (diff) | |
download | dotfiles-5bfebd765f1de0bf662e1c7ea75533971e8e502f.tar.gz dotfiles-5bfebd765f1de0bf662e1c7ea75533971e8e502f.zip |
Switch compopt back out
Damn, looks like 2.05a doesn't have compopt; put it back into the
complete line
Diffstat (limited to 'bash/bashrc.d')
-rw-r--r-- | bash/bashrc.d/bd.bash | 5 | ||||
-rw-r--r-- | bash/bashrc.d/ftp.bash | 5 | ||||
-rw-r--r-- | bash/bashrc.d/git.bash | 5 | ||||
-rw-r--r-- | bash/bashrc.d/gpg.bash | 5 | ||||
-rw-r--r-- | bash/bashrc.d/make.bash | 5 | ||||
-rw-r--r-- | bash/bashrc.d/mysql.bash | 6 | ||||
-rw-r--r-- | bash/bashrc.d/path.bash | 9 | ||||
-rw-r--r-- | bash/bashrc.d/sd.bash | 5 | ||||
-rw-r--r-- | bash/bashrc.d/ssh.bash | 5 | ||||
-rw-r--r-- | bash/bashrc.d/ud.bash | 5 |
10 files changed, 15 insertions, 40 deletions
diff --git a/bash/bashrc.d/bd.bash b/bash/bashrc.d/bd.bash index e4a6738e..bfef89f2 100644 --- a/bash/bashrc.d/bd.bash +++ b/bash/bashrc.d/bd.bash @@ -80,9 +80,6 @@ bd() { # Completion setup for bd _bd() { - # The completions given are filenames and may require escaping - compopt -o filenames - # Only makes sense for the first argument ((COMP_CWORD == 1)) || return 1 @@ -101,5 +98,5 @@ _bd() { COMPREPLY=("${COMPREPLY[@]}" "$dirname") done } -complete -F _bd bd +complete -F _bd -o filenames bd diff --git a/bash/bashrc.d/ftp.bash b/bash/bashrc.d/ftp.bash index f046a683..218afc2c 100644 --- a/bash/bashrc.d/ftp.bash +++ b/bash/bashrc.d/ftp.bash @@ -1,9 +1,6 @@ # Completion for ftp with .netrc machines _ftp() { - # Do default completion if no results - compopt -o default - # Bail if the .netrc file is illegible local netrc netrc=$HOME/.netrc @@ -33,5 +30,5 @@ _ftp() { COMPREPLY=("${COMPREPLY[@]}" "$machine") done } -complete -F _ftp ftp +complete -F _ftp -o default ftp diff --git a/bash/bashrc.d/git.bash b/bash/bashrc.d/git.bash index 182cef46..7e0b2028 100644 --- a/bash/bashrc.d/git.bash +++ b/bash/bashrc.d/git.bash @@ -1,9 +1,6 @@ # Completion for git local branch names _git() { - # Use default completion if no matches - compopt -o default - # Bail if not a git repo (or no git!) git rev-parse --git-dir >/dev/null 2>&1 || return 1 @@ -26,5 +23,5 @@ _git() { ;; esac } -complete -F _git git +complete -F _git -o default git diff --git a/bash/bashrc.d/gpg.bash b/bash/bashrc.d/gpg.bash index 3f01db64..cea4a7cb 100644 --- a/bash/bashrc.d/gpg.bash +++ b/bash/bashrc.d/gpg.bash @@ -15,9 +15,6 @@ gpg() { # Completion for gpg with long options _gpg() { - # Complete with directories/files if no matches - compopt -o default - # Bail if no gpg(1) hash gpg 2>/dev/null || return 1 @@ -31,5 +28,5 @@ _gpg() { COMPREPLY=("${COMPREPLY[@]}" "$option") done < <(gpg --dump-options 2>/dev/null) } -complete -F _gpg gpg +complete -F _gpg -o default gpg diff --git a/bash/bashrc.d/make.bash b/bash/bashrc.d/make.bash index 216894fd..8580572e 100644 --- a/bash/bashrc.d/make.bash +++ b/bash/bashrc.d/make.bash @@ -1,9 +1,6 @@ # Completion setup for Make, completing targets _make() { - # Do default completion if no matches - compopt -o default - # Bail if no legible Makefile [[ ! -r Makefile ]] || return 1 @@ -29,5 +26,5 @@ _make() { COMPREPLY=("${COMPREPLY[@]}" "$target") done } -complete -F _make make +complete -F _make -o default make diff --git a/bash/bashrc.d/mysql.bash b/bash/bashrc.d/mysql.bash index 33231c13..67feca3c 100644 --- a/bash/bashrc.d/mysql.bash +++ b/bash/bashrc.d/mysql.bash @@ -24,10 +24,6 @@ mysql() { # Completion setup for MySQL for configured databases _mysql() { - # The completed results are filenames, and if there are no matches, do - # default completion - compopt -o filenames -o default - # Only makes sense for first argument ((COMP_CWORD == 1)) || return 1 @@ -59,5 +55,5 @@ _mysql() { printf '%s\0' "${cnfs[@]}" ) } -complete -F _mysql mysql +complete -F _mysql -o default -o filenames mysql diff --git a/bash/bashrc.d/path.bash b/bash/bashrc.d/path.bash index c3e02627..bd290fb3 100644 --- a/bash/bashrc.d/path.bash +++ b/bash/bashrc.d/path.bash @@ -197,7 +197,6 @@ _path() { # Complete with a directory insert|i|append|add|a|check|c|set|s) - compopt -o filenames local dirname while IFS= read -d '' -r dirname ; do [[ $dirname == "${COMP_WORDS[COMP_CWORD]}"/* ]] \ @@ -223,7 +222,6 @@ _path() { # Complete with directories from PATH remove|rm|r) - compopt -o filenames local -a promptarr IFS=: read -d '' -a promptarr < <(printf '%s\0' "$PATH") local part @@ -242,5 +240,10 @@ _path() { ;; esac } -complete -F _path path + +# The use of -o filenames isn't strictly correct. The first completed world +# will actually just be a simple string, the sub-command to use. However in +# practice it doesn't matter as it's a fixed set of strings that won't be +# quoted anyway. +complete -F _path -o filenames path diff --git a/bash/bashrc.d/sd.bash b/bash/bashrc.d/sd.bash index ccc4aec7..d127321e 100644 --- a/bash/bashrc.d/sd.bash +++ b/bash/bashrc.d/sd.bash @@ -111,9 +111,6 @@ sd() { # Completion function for sd; any sibling directories, excluding the self _sd() { - # The completed results are filenames - compopt -o filenames - # Only makes sense for the first argument ((COMP_CWORD == 1)) || return 1 @@ -143,5 +140,5 @@ _sd() { printf '%s\0' "${dirnames[@]}" ) } -complete -F _sd sd +complete -F _sd -o filenames sd diff --git a/bash/bashrc.d/ssh.bash b/bash/bashrc.d/ssh.bash index 223aace8..67c2828a 100644 --- a/bash/bashrc.d/ssh.bash +++ b/bash/bashrc.d/ssh.bash @@ -1,9 +1,6 @@ # Completion for ssh/sftp/ssh-copy-id with config hostnames _ssh() { - # Use default completion if no matches - compopt -o default - # Read hostnames from existent config files, no asterisks local -a hosts local config option value @@ -22,5 +19,5 @@ _ssh() { COMPREPLY=("${COMPREPLY[@]}" "$host") done } -complete -F _ssh ssh sftp ssh-copy-id +complete -F _ssh -o default ssh sftp ssh-copy-id diff --git a/bash/bashrc.d/ud.bash b/bash/bashrc.d/ud.bash index 7a715a52..46dbdd71 100644 --- a/bash/bashrc.d/ud.bash +++ b/bash/bashrc.d/ud.bash @@ -52,9 +52,6 @@ ud() { # Completion setup for ud _ud() { - # The completions given are filenames and may require escaping - compopt -o filenames - # Only makes sense for the second argument ((COMP_CWORD == 2)) || return 1 @@ -80,5 +77,5 @@ _ud() { printf '%s\0' "${dirnames[@]}" ) } -complete -F _ud ud +complete -F _ud -o filenames ud |