[Bash-completion-devel] [PATCH 3/3] chronyc: Update help text parsing

Miroslav Lichvar mlichvar at redhat.com
Tue Oct 6 15:45:00 UTC 2015


In chrony-2.2 the chronyc help text formating was changed, the command
descriptions now may be on muliple lines and the commands are divided in
sections.
---
 completions/chronyc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/completions/chronyc b/completions/chronyc
index b95308f..7a5f5f6 100644
--- a/completions/chronyc
+++ b/completions/chronyc
@@ -28,7 +28,7 @@ _chronyc()
     case $args in
         0)
             COMPREPLY=( $( compgen -W "$( $1 help 2>/dev/null | \
-                awk 'NR > 1 { sub("\\|", " ", $1); print $1 }' )" -- "$cur" ) )
+                awk '!/(^ |: *$)/ { sub("\\|", " ", $1); print $1 }' )" -- "$cur" ) )
             ;;
         1)
             case $prev in
-- 
2.1.0




More information about the Bash-completion-devel mailing list