summarylogtreecommitdiffstats
path: root/bash_completion
diff options
context:
space:
mode:
authorPiotr Rogoża2015-06-14 15:51:59 +0200
committerPiotr Rogoża2015-06-14 15:51:59 +0200
commit485dd936cb3e618b19204fd2feccfa130b093e5b (patch)
treeff819e8e895b9e4403ce2cb483b5a4098be944cf /bash_completion
downloadaur-nginx-site.tar.gz
Initial import
Diffstat (limited to 'bash_completion')
-rw-r--r--bash_completion31
1 files changed, 31 insertions, 0 deletions
diff --git a/bash_completion b/bash_completion
new file mode 100644
index 000000000000..a733fea8e36a
--- /dev/null
+++ b/bash_completion
@@ -0,0 +1,31 @@
+# vi ft=sh
+# bash completion for nginx configuration tools
+_nginx_modsites()
+{
+ COMPREPLY=( $( compgen -W '$( command ls /etc/nginx/$1 2>/dev/null \
+ | sed -e 's/[.]conf$//' )' -- $cur ) )
+}
+
+_nginx-ensite()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+
+ _nginx_modsites sites-available
+
+}
+complete -F _nginx-ensite nginx-ensite
+
+_nginx-dissite()
+{
+ local cur
+
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+
+ _nginx_modsites sites-enabled
+
+}
+complete -F _nginx-dissite nginx-dissite