]> git.ipfire.org Git - thirdparty/git.git/commit
completion: use awk for filtering the config entries
authorBeat Bolli <dev+git@drbeat.li>
Fri, 16 Feb 2024 17:10:46 +0000 (18:10 +0100)
committerJunio C Hamano <gitster@pobox.com>
Fri, 16 Feb 2024 20:14:11 +0000 (12:14 -0800)
commit3c2e3d42d117197ead05264d47fb6eea0a3834c3
tree71a1692f00bc6ba627c88f6eab09dddf6ec0253c
parent3e0d3cd5c7def4808247caf168e17f2bbf47892b
completion: use awk for filtering the config entries

Commits 1e0ee4087e (completion: add and use
__git_compute_first_level_config_vars_for_section, 2024-02-10) and
6e32f718ff (completion: add and use
__git_compute_second_level_config_vars_for_section, 2024-02-10)
introduced new helpers for config completion.

Both helpers use a pipeline of grep and awk to filter the list of config
entries. awk is perfectly capable of filtering, so let's eliminate the
grep process and move the filtering into the awk script.

The "-E" grep option (extended syntax) was not necessary, as $section is
a single word.

While at it, wrap the over-long lines to make them more readable.

Signed-off-by: Beat Bolli <dev+git@drbeat.li>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
contrib/completion/git-completion.bash