Skip to content

Request for feedback on tooling change #1718

Description

@cam72cam

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions