Hello, I'm one of the maintainers of https://github.com/opentofu/opentofu and am in the middle of re-building our CLI. As part of this, we are considering switching away from https://github.com/posener/complete/ (out of date and likely unmaintained) and using the the builtin completion of https://github.com/urfave/cli or https://github.com/spf13/cobra.
While investigating this issue, I found that this library ships a default completion for tofu that uses the complete -C method. While that is useful, it makes migrating to a new solution a bit trickier, especially since the two mentioned above use custom completion functions (complete -F).
As of writing this, I have proposed that we add in backward compatibility for $COMP_LINE and respect the existing installations. The only other alternative here is to suggest users run tofu -install-autocomplete and re-source their ~/.bashrc, though I don't much like that approach. Luckily, my initial prototyping has shown that the maintenance burden of keeping rudimentary support for $COMP_LINE is pretty minimal.
My primary question is if the approach of supporting the both paths is typical and if there is a way to change the shipped bash-completion default for tofu to something along the lines of source <(tofu completion bash).
Additionally, is it preferred for tooling to use use -C or -F when building in auto-completion?
My last question is if user installation into $HOME/.bash_completion is the recommended option if targeting older systems? I tried using the $BASH_COMPLETION_USER_DIR and $XDG_DATA_HOME startup options, but ran into it being a relatively (2yr old) feature that debian testing still does not yet ship.
If you are curious and are looking for more details, we are discussing this on our end in an RFC at opentofu/opentofu#4445.
Thank you again for your time in considering my questions and for the ongoing work that goes into maintaining this project!
Hello, I'm one of the maintainers of https://github.com/opentofu/opentofu and am in the middle of re-building our CLI. As part of this, we are considering switching away from https://github.com/posener/complete/ (out of date and likely unmaintained) and using the the builtin completion of https://github.com/urfave/cli or https://github.com/spf13/cobra.
While investigating this issue, I found that this library ships a default completion for tofu that uses the
complete -Cmethod. While that is useful, it makes migrating to a new solution a bit trickier, especially since the two mentioned above use custom completion functions (complete -F).As of writing this, I have proposed that we add in backward compatibility for
$COMP_LINEand respect the existing installations. The only other alternative here is to suggest users runtofu -install-autocompleteand re-source their~/.bashrc, though I don't much like that approach. Luckily, my initial prototyping has shown that the maintenance burden of keeping rudimentary support for$COMP_LINEis pretty minimal.My primary question is if the approach of supporting the both paths is typical and if there is a way to change the shipped bash-completion default for tofu to something along the lines of
source <(tofu completion bash).Additionally, is it preferred for tooling to use use
-Cor-Fwhen building in auto-completion?My last question is if user installation into
$HOME/.bash_completionis the recommended option if targeting older systems? I tried using the$BASH_COMPLETION_USER_DIRand$XDG_DATA_HOMEstartup options, but ran into it being a relatively (2yr old) feature that debian testing still does not yet ship.If you are curious and are looking for more details, we are discussing this on our end in an RFC at opentofu/opentofu#4445.
Thank you again for your time in considering my questions and for the ongoing work that goes into maintaining this project!