GNU bug report logs - #43509
[PATCH] bash completion: Fix completion for commands and subcommands.

Previous Next

Package: guix-patches;

Reported by: Oleg Pykhalov <go.wigust <at> gmail.com>

Date: Sat, 19 Sep 2020 12:54:02 UTC

Severity: normal

Tags: patch

Done: Ludovic Courtès <ludo <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 43509 in the body.
You can then email your comments to 43509 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#43509; Package guix-patches. (Sat, 19 Sep 2020 12:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Sat, 19 Sep 2020 12:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Oleg Pykhalov <go.wigust <at> gmail.com>
To: guix-patches <at> gnu.org
Cc: Oleg Pykhalov <go.wigust <at> gmail.com>
Subject: [PATCH] bash completion: Fix completion for commands and subcommands.
Date: Sat, 19 Sep 2020 15:52:51 +0300
* etc/completion/bash/guix
(_guix_complete_command, _guix_complete_subcommand): Fix completion.
---
 etc/completion/bash/guix | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/etc/completion/bash/guix b/etc/completion/bash/guix
index 98d20484f7..3bc9a48947 100644
--- a/etc/completion/bash/guix
+++ b/etc/completion/bash/guix
@@ -27,8 +27,7 @@ _guix_complete_command ()
     if [ -z "$_guix_commands" ]
     then
 	# Cache the list of commands to speed things up.
-	_guix_commands="$(guix --help 2> /dev/null \
-                                     | grep '^  ' | cut -c 2-)"
+	_guix_commands="$(guix --help 2> /dev/null | awk '/^    [a-z]/ { print $1 }')"
     fi
     COMPREPLY=($(compgen -W "$_guix_commands" -- "$word_at_point"))
 }
@@ -36,9 +35,7 @@ _guix_complete_command ()
 _guix_complete_subcommand ()
 {
     local command="${COMP_WORDS[1]}"
-    local subcommands="$(${COMP_WORDS[0]} $command --help 2> /dev/null \
-                         | grep '^   [a-z]' \
-                         | sed -e's/^ \+\([a-z-]\+\).*$/\1/g')"
+    local subcommands="$(${COMP_WORDS[0]} $command --help 2> /dev/null | awk '/^   [a-z]/ { print $1 }')"
     COMPREPLY=($(compgen -W "$subcommands" -- "${COMP_WORDS[$COMP_CWORD]}"))
 }
 
-- 
2.28.0





Information forwarded to guix-patches <at> gnu.org:
bug#43509; Package guix-patches. (Mon, 21 Sep 2020 21:42:01 GMT) Full text and rfc822 format available.

Message #8 received at 43509 <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 43509 <at> debbugs.gnu.org
Subject: Re: [bug#43509] [PATCH] bash completion: Fix completion for
 commands and subcommands.
Date: Mon, 21 Sep 2020 23:41:18 +0200
Hi!

Oleg Pykhalov <go.wigust <at> gmail.com> skribis:

> * etc/completion/bash/guix
> (_guix_complete_command, _guix_complete_subcommand): Fix completion.

Oops, I see.  Could you mention in the commit log that this is a
followup to 3794ce93be8216d8378df7b808ce7f53b1e05a53, which broke it all
(right?).

>  	# Cache the list of commands to speed things up.
> -	_guix_commands="$(guix --help 2> /dev/null \
> -                                     | grep '^  ' | cut -c 2-)"
> +	_guix_commands="$(guix --help 2> /dev/null | awk '/^    [a-z]/ { print $1 }')"

Could we avoid awk?

Thanks,
Ludo’.




Reply sent to Ludovic Courtès <ludo <at> gnu.org>:
You have taken responsibility. (Thu, 24 Sep 2020 15:59:02 GMT) Full text and rfc822 format available.

Notification sent to Oleg Pykhalov <go.wigust <at> gmail.com>:
bug acknowledged by developer. (Thu, 24 Sep 2020 15:59:03 GMT) Full text and rfc822 format available.

Message #13 received at 43509-done <at> debbugs.gnu.org (full text, mbox):

From: Ludovic Courtès <ludo <at> gnu.org>
To: Oleg Pykhalov <go.wigust <at> gmail.com>
Cc: 43509-done <at> debbugs.gnu.org
Subject: Re: [bug#43509] [PATCH] bash completion: Fix completion for
 commands and subcommands.
Date: Thu, 24 Sep 2020 17:57:42 +0200
Hi,

Ludovic Courtès <ludo <at> gnu.org> skribis:

> Oleg Pykhalov <go.wigust <at> gmail.com> skribis:
>
>> * etc/completion/bash/guix
>> (_guix_complete_command, _guix_complete_subcommand): Fix completion.
>
> Oops, I see.  Could you mention in the commit log that this is a
> followup to 3794ce93be8216d8378df7b808ce7f53b1e05a53, which broke it all
> (right?).
>
>>  	# Cache the list of commands to speed things up.
>> -	_guix_commands="$(guix --help 2> /dev/null \
>> -                                     | grep '^  ' | cut -c 2-)"
>> +	_guix_commands="$(guix --help 2> /dev/null | awk '/^    [a-z]/ { print $1 }')"
>
> Could we avoid awk?

I went ahead and did that in 8e0c5033b17fcf1e4596ee9a3d52157900acc6fa.

Completion’s back!  :-)

Ludo’.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 23 Oct 2020 11:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 3 years and 185 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.