Util-Linux Archive mirror
 help / color / mirror / Atom feed
From: Eli Schwartz <eschwartz93@gmail.com>
To: util-linux@vger.kernel.org
Subject: [PATCH] bash-completion: make sure that "lastb" actually completes
Date: Wed,  6 Dec 2023 19:40:44 -0500	[thread overview]
Message-ID: <20231207004204.3443364-1-eschwartz93@gmail.com> (raw)

Building util-linux logs a warning on Gentoo:

```
 * Problems with installed bash completions were found:
 *
 * 	lastb: incorrect name, no completions for 'lastb' command defined.
 *
 * For more details on installing bash-completions, please see:
 * https://wiki.gentoo.org/wiki/Bash/Installing_completion_files
```

A bash-completion file is usually composed of two parts:
- a function that knows how to produce completions
- a specification of which command should be completed

In cases where multiple commands have the same options, e.g. commands
that are symlinked to each other, it is common to symlink the completion
files as well. This shares the first part. But the second part cannot be
shared, it must be implemented twice by specifying two different
commands to be completed.

"lastb" had a symlinked completion, but when the completion system
processes /usr/share/bash-completion/completions/lastb, it would only
define a completion for "last".

Define both completions in one file, so that sourcing it works
regardless of command used.
---
 bash-completion/last | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/bash-completion/last b/bash-completion/last
index 180d9a94b..ff264c1d2 100644
--- a/bash-completion/last
+++ b/bash-completion/last
@@ -51,4 +51,4 @@ _last_module()
 	COMPREPLY=( $(compgen -u -- $cur) )
 	return 0
 }
-complete -F _last_module last
+complete -F _last_module last lastb
-- 
2.41.0


             reply	other threads:[~2023-12-07  0:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-07  0:40 Eli Schwartz [this message]
2023-12-08 11:45 ` [PATCH] bash-completion: make sure that "lastb" actually completes Karel Zak

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231207004204.3443364-1-eschwartz93@gmail.com \
    --to=eschwartz93@gmail.com \
    --cc=util-linux@vger.kernel.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.
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).