[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[patch] bash_completion



Attached are 2 patches for bash_completion.
First one is from http://bugs.debian.org/657492
Second one adds support for a2(en|dis)conf

I let you handle the changelog. Note that this (Closes: #657492)

Also, bash_completion/apache2-common is listed in debian/apache2-data.install
I suggest we let dh_bashcompletion handle this, and move it to apache2 package where the binary is.
That means renaming debian/bash_completion/apache2-common to debian/apache2.bash_completion
Unless we want to be smart about old conflicting file /etc/bash_completion.d/apache2.2-common ...
From 318a3a473a18cb89ebdf02c93d6c3ed062a7be82 Mon Sep 17 00:00:00 2001
From: Ludovico Gardenghi <garden@debian.org>
Date: Fri, 24 Feb 2012 21:58:26 +0100
Subject: [PATCH 1/2] bash_completion: a2{en,dis}site don't strip .conf

...nor .load
Fixes: #657492
---
 debian/bash_completion/apache2-common |   22 ++++++++++++++++------
 1 files changed, 16 insertions(+), 6 deletions(-)

diff --git a/debian/bash_completion/apache2-common b/debian/bash_completion/apache2-common
index c24b2e5..0204589 100644
--- a/debian/bash_completion/apache2-common
+++ b/debian/bash_completion/apache2-common
@@ -1,12 +1,22 @@
 # bash completion for Debian apache2 configuration tools
 # $Id: apache2,v 1.1 2005/03/16 22:51:19 guillaume Exp $
 
-_apache2_modsites()
+_apache2_allcomp()
 {
-       COMPREPLY=( $( compgen -W '$( command ls /etc/apache2/$1 2>/dev/null \
+       command ls /etc/apache2/$1 2>/dev/null
+}
+
+_apache2_mods()
+{
+       COMPREPLY=( $( compgen -W '$( _apache2_allcomp $1 \
                | sed -e 's/[.]load$//' -e 's/[.]conf$//' )' -- $cur  ) )
 }
 
+_apache2_sites()
+{
+       COMPREPLY=( $( compgen -W '$( _apache2_allcomp $1 )' -- $cur  ) )
+}
+
 _a2enmod()
 {
        local cur
@@ -14,7 +24,7 @@ _a2enmod()
        COMPREPLY=()
        cur=${COMP_WORDS[COMP_CWORD]}
 
-       _apache2_modsites mods-available
+       _apache2_mods mods-available
 }
 complete -F _a2enmod a2enmod
 
@@ -25,7 +35,7 @@ _a2ensite()
        COMPREPLY=()
        cur=${COMP_WORDS[COMP_CWORD]}
 
-       _apache2_modsites sites-available
+       _apache2_sites sites-available
 
 }
 complete -F _a2ensite a2ensite
@@ -37,7 +47,7 @@ _a2dismod()
        COMPREPLY=()
        cur=${COMP_WORDS[COMP_CWORD]}
 
-       _apache2_modsites mods-enabled
+       _apache2_mods mods-enabled
 }
 complete -F _a2dismod a2dismod
 
@@ -48,7 +58,7 @@ _a2dissite()
        COMPREPLY=()
        cur=${COMP_WORDS[COMP_CWORD]}
 
-       _apache2_modsites sites-enabled
+       _apache2_sites sites-enabled
 
 }
 complete -F _a2dissite a2dissite
-- 
1.7.9

From 0c3d85f6d838f2faec43fa70592ec9abbeb297da Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Michel=20Vourg=C3=A8re?= <jmv_deb@nirgal.com>
Date: Fri, 24 Feb 2012 22:02:27 +0100
Subject: [PATCH 2/2] bash_completion: Support for a2(en|dis)conf

---
 debian/bash_completion/apache2-common |   31 ++++++++++++++++++++++++++++---
 1 files changed, 28 insertions(+), 3 deletions(-)

diff --git a/debian/bash_completion/apache2-common b/debian/bash_completion/apache2-common
index 0204589..e57c100 100644
--- a/debian/bash_completion/apache2-common
+++ b/debian/bash_completion/apache2-common
@@ -1,5 +1,4 @@
 # bash completion for Debian apache2 configuration tools
-# $Id: apache2,v 1.1 2005/03/16 22:51:19 guillaume Exp $
 
 _apache2_allcomp()
 {
@@ -17,6 +16,12 @@ _apache2_sites()
        COMPREPLY=( $( compgen -W '$( _apache2_allcomp $1 )' -- $cur  ) )
 }
 
+_apache2_conf()
+{
+       COMPREPLY=( $( compgen -W '$( _apache2_allcomp $1 \
+               | sed -e 's/[.]conf$//' )' -- $cur  ) )
+}
+
 _a2enmod()
 {
        local cur
@@ -36,10 +41,20 @@ _a2ensite()
        cur=${COMP_WORDS[COMP_CWORD]}
 
        _apache2_sites sites-available
-
 }
 complete -F _a2ensite a2ensite
 
+_a2enconf()
+{
+       local cur
+
+       COMPREPLY=()
+       cur=${COMP_WORDS[COMP_CWORD]}
+
+       _apache2_conf conf-available
+}
+complete -F _a2enconf a2enconf
+
 _a2dismod()
 {
        local cur
@@ -59,6 +74,16 @@ _a2dissite()
        cur=${COMP_WORDS[COMP_CWORD]}
 
        _apache2_sites sites-enabled
-
 }
 complete -F _a2dissite a2dissite
+
+_a2disconf()
+{
+       local cur
+
+       COMPREPLY=()
+       cur=${COMP_WORDS[COMP_CWORD]}
+
+       _apache2_conf conf-enabled
+}
+complete -F _a2disconf a2disconf
-- 
1.7.9

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: