ISC bind-utils dig completion with hints helper option file for "@"#1625
ISC bind-utils dig completion with hints helper option file for "@"#1625
Conversation
Signed-off-by: Mauricio Vergara Ereche <mave@cero32.cl>
…ading Signed-off-by: Mauricio Vergara Ereche <mave@cero32.cl>
Signed-off-by: Mauricio Vergara Ereche <mave@cero32.cl>
scop
left a comment
There was a problem hiding this comment.
Thank you for working on making bash completions better. But to verify, did you notice the two few paragraphs of CONTRIBUTING.md as linked in the PR creation view, in particular:
However, before submitting a completion to us, first consider submitting it to the project that ships the commands your completion is for.
If you considered submitting it upstream, let's include the explanation why submit it here instead. If it was asked upstream and rejected there, let's add a link to the response.
|
Still waiting for answer from current maintainer in https://gitlab.isc.org/isc-projects/bind9/-/issues/4879 I think the biggest issue we will face, is if that is uploaded on ISC end, then in this project we will still need to remove the lazy-load on If that is not done in this project, it implies the user will need to do the following on their own shell to load it after the load of _comp_load dig 2>/dev/nullwhich it's not the end of the world... but definitely not intuitive. |
That's not really an issue. First of all, that "issue" is not specific to Rencently, I also thought about related changes associated with #1558 and #1339. We may move all these |
Summary
Adding dedicated completion for ISC BIND dig (
completions-core/dig.bash), registers it in the build, adds tests, and removesdigfrom the generic_comp_complete_known_hostsregistration inbash_completionso installeddig.bashcan take effect instead of always completing only hostnames.Behavior (
completions-core/dig.bash)+queryoptions and@server-c/-tflags) completion stops offering more classes or types. Meanwhile+options can be multiple.ANY: classified as RRTYPE first (matchesdig <NAME> ANY);*.bind-style names when class isCHand type isTXT.-q, dotted tokens, or non–class/type-prefix tokens use_comp_compgen_known_hostswhere applicable.compopt +o bashdefault +o defaultto avoid broad default hostname fallback on emptyCOMPREPLY.@server:~/.ssh/known_hosts, orBASH_COMPLETION_CMD_DIG_NS_HINTS_FILEfor suffix-based hints (longest pattern wins,*defaults; trailing dots on name/pattern normalized). Format documented in commentsExample of
$BASH_COMPLETION_CMD_DIG_NS_HINTS_FILE:Note on removing
digfrom./bash_completionGiven that
digwas registered with_comp_complete_known_hosts, that generic hostname completer took precedence over the lazy-loadedcompletions-core/dig.bash, so dedicated completion for class, RR type, @server, and + options never ran.The other option to avoid this case is to add into
.bashrcor.bash_profilethe load of the dig completion after loading bash-completion with_comp_load(example in macos withbrewinstallation):Files
completions-core/dig.bashcompletions-core/Makefile.amdig.bashbash_completiondigwith_comp_complete_known_hoststest/t/test_dig.pytest/t/Makefile.amtest_dig.pyTesting
pytest test/t/test_dig.py(cases withrequire_cmd=Trueneed dig on PATH).