From: Oleg Pykhalov <go.wigust@gmail.com>
To: 43509@debbugs.gnu.org
Cc: Oleg Pykhalov <go.wigust@gmail.com>
Subject: [bug#43509] [PATCH] bash completion: Fix completion for commands and subcommands.
Date: Sat, 19 Sep 2020 15:52:51 +0300 [thread overview]
Message-ID: <20200919125251.3124-1-go.wigust@gmail.com> (raw)
* 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
next reply other threads:[~2020-09-19 12:54 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-19 12:52 Oleg Pykhalov [this message]
2020-09-21 21:41 ` [bug#43509] [PATCH] bash completion: Fix completion for commands and subcommands Ludovic Courtès
2020-09-24 15:57 ` bug#43509: " Ludovic Courtès
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://guix.gnu.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200919125251.3124-1-go.wigust@gmail.com \
--to=go.wigust@gmail.com \
--cc=43509@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/guix.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).