aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Ryder <tom@sanctum.geek.nz>2017-02-12 00:07:27 +1300
committerTom Ryder <tom@sanctum.geek.nz>2017-02-12 00:07:27 +1300
commit2d69a56b9d1314658de29ace609a11d312a66130 (patch)
tree90487e5ea7baf315ea0a7db673cf701b86a36839
parent18a5463ea2d39cb5502eb3cfba7281f03472bfd1 (diff)
downloaddotfiles-2d69a56b9d1314658de29ace609a11d312a66130.tar.gz
Use bashdefault if available in more completions
-rw-r--r--bash/bash_completion.d/ftp.bash8
-rw-r--r--bash/bash_completion.d/gpg.bash8
-rw-r--r--bash/bash_completion.d/make.bash8
-rw-r--r--bash/bash_completion.d/man.bash8
-rw-r--r--bash/bash_completion.d/mysql.bash8
-rw-r--r--bash/bash_completion.d/sftp.bash8
-rw-r--r--bash/bash_completion.d/ssh-copy-id.bash8
-rw-r--r--bash/bash_completion.d/ssh.bash8
8 files changed, 56 insertions, 8 deletions
diff --git a/bash/bash_completion.d/ftp.bash b/bash/bash_completion.d/ftp.bash
index e6d292a9..335d711a 100644
--- a/bash/bash_completion.d/ftp.bash
+++ b/bash/bash_completion.d/ftp.bash
@@ -30,4 +30,10 @@ _ftp() {
COMPREPLY[${#COMPREPLY[@]}]=$machine
done
}
-complete -F _ftp -o default ftp
+
+# bashdefault requires Bash >=3.0
+if ((BASH_VERSINFO[0] >= 3)) ; then
+ complete -F _ftp -o bashdefault -o default ftp
+else
+ complete -F _ftp -o default ftp
+fi
diff --git a/bash/bash_completion.d/gpg.bash b/bash/bash_completion.d/gpg.bash
index fcb48b91..6d4cf345 100644
--- a/bash/bash_completion.d/gpg.bash
+++ b/bash/bash_completion.d/gpg.bash
@@ -14,4 +14,10 @@ _gpg() {
COMPREPLY[${#COMPREPLY[@]}]=$option
done < <(gpg --dump-options 2>/dev/null)
}
-complete -F _gpg -o default gpg
+
+# bashdefault requires Bash >=3.0
+if ((BASH_VERSINFO[0] >= 3)) ; then
+ complete -F _gpg -o bashdefault -o default gpg
+else
+ complete -F _gpg -o default gpg
+fi
diff --git a/bash/bash_completion.d/make.bash b/bash/bash_completion.d/make.bash
index b3314e21..bb01b36a 100644
--- a/bash/bash_completion.d/make.bash
+++ b/bash/bash_completion.d/make.bash
@@ -48,4 +48,10 @@ _make() {
esac
done < "$mf"
}
-complete -F _make -o default make
+
+# bashdefault requires Bash >=3.0
+if ((BASH_VERSINFO[0] >= 3)) ; then
+ complete -F _make -o bashdefault -o default make
+else
+ complete -F _make -o default make
+fi
diff --git a/bash/bash_completion.d/man.bash b/bash/bash_completion.d/man.bash
index f779d203..658b5eb7 100644
--- a/bash/bash_completion.d/man.bash
+++ b/bash/bash_completion.d/man.bash
@@ -69,4 +69,10 @@ _man() {
fi
)
}
-complete -F _man -o default man
+
+# bashdefault requires Bash >=3.0
+if ((BASH_VERSINFO[0] >= 3)) ; then
+ complete -F _man -o bashdefault -o default man
+else
+ complete -F _man -o default man
+fi
diff --git a/bash/bash_completion.d/mysql.bash b/bash/bash_completion.d/mysql.bash
index 9755f033..2886f62e 100644
--- a/bash/bash_completion.d/mysql.bash
+++ b/bash/bash_completion.d/mysql.bash
@@ -35,4 +35,10 @@ _mysql() {
fi
)
}
-complete -F _mysql -o default mysql
+
+# bashdefault requires Bash >=3.0
+if ((BASH_VERSINFO[0] >= 3)) ; then
+ complete -F _mysql -o bashdefault -o default mysql
+else
+ complete -F _mysql -o default mysql
+fi
diff --git a/bash/bash_completion.d/sftp.bash b/bash/bash_completion.d/sftp.bash
index 5d52c739..60044e41 100644
--- a/bash/bash_completion.d/sftp.bash
+++ b/bash/bash_completion.d/sftp.bash
@@ -1,4 +1,10 @@
# Completion for sftp(1) with ssh_config(5) hostnames
declare -F _ssh_config_hosts >/dev/null ||
source "$HOME"/.bash_completion.d/_ssh_config_hosts.bash
-complete -F _ssh_config_hosts -o default sftp
+
+# bashdefault requires Bash >=3.0
+if ((BASH_VERSINFO[0] >= 3)) ; then
+ complete -F _ssh_config_hosts -o bashdefault -o default sftp
+else
+ complete -F _ssh_config_hosts -o default sftp
+fi
diff --git a/bash/bash_completion.d/ssh-copy-id.bash b/bash/bash_completion.d/ssh-copy-id.bash
index daf52751..5e4fe99b 100644
--- a/bash/bash_completion.d/ssh-copy-id.bash
+++ b/bash/bash_completion.d/ssh-copy-id.bash
@@ -1,4 +1,10 @@
# Completion for ssh-copy-id(1) with ssh_config(5) hostnames
declare -F _ssh_config_hosts >/dev/null ||
source "$HOME"/.bash_completion.d/_ssh_config_hosts.bash
-complete -F _ssh_config_hosts -o default ssh-copy-id
+
+# bashdefault requires Bash >=3.0
+if ((BASH_VERSINFO[0] >= 3)) ; then
+ complete -F _ssh_config_hosts -o bashdefault -o default ssh-copy-id
+else
+ complete -F _ssh_config_hosts -o default ssh-copy-id
+fi
diff --git a/bash/bash_completion.d/ssh.bash b/bash/bash_completion.d/ssh.bash
index 03745eaa..c8212614 100644
--- a/bash/bash_completion.d/ssh.bash
+++ b/bash/bash_completion.d/ssh.bash
@@ -1,4 +1,10 @@
# Completion for ssh(1) with ssh_config(5) hostnames
declare -F _ssh_config_hosts >/dev/null ||
source "$HOME"/.bash_completion.d/_ssh_config_hosts.bash
-complete -F _ssh_config_hosts -o default ssh
+
+# bashdefault requires Bash >=3.0
+if ((BASH_VERSINFO[0] >= 3)) ; then
+ complete -F _ssh_config_hosts -o bashdefault -o default ssh
+else
+ complete -F _ssh_config_hosts -o default ssh
+fi