]> git.ipfire.org Git - thirdparty/util-linux.git/commit
bash-completion: look: rewrite completion logic
authorYao Zi <ziyao@disroot.org>
Mon, 9 Sep 2024 18:08:30 +0000 (18:08 +0000)
committerYao Zi <ziyao@disroot.org>
Wed, 11 Sep 2024 17:04:53 +0000 (17:04 +0000)
commit5aee3a1e6b0609acca371307f418f89e5a641136
tree755b62085765f23a2c9e511f4450a9e4f97197f0
parent7ab6dae899be6becde48babf1032930a98a0ac5e
bash-completion: look: rewrite completion logic

look(1) opens /usr/share/dict/words as dictionary by default. Doing TAB
completion for look(1) without the dictionary installed will result in
popups like

$ look look: /usr/share/dict/words: No such file or directory

messing up the terminal.

As /usr/share/dict/words is not shipped by quite a few distros nowadays
and it should not be listed as a hard dependency of util-linux, we make
sure the dictionary exists before calling look(1) when doing completion,
avoiding these error messages.

When completing the word without anything specified on the command line,
alphabets and numbers instead of all words are listed as a hint, for
better interacting experience.

Signed-off-by: Yao Zi <ziyao@disroot.org>
bash-completion/look