Skip to content

Add CLI completion #8616

Closed
Closed

Description

@lwbt

Hello, I recently found out that many Go projects use https://github.com/spf13/cobra which among other features offers command completion for a wide variety of shells without writing separate completers. I thought it was a de-facto standard until I noticed that the first Go program I ever started to use (Syncthing) and am very happy with, except with its CLI, had no command completion.

Would that be a big refactoring of code?

What problem your new feature would solve

Making options, parameters and help more accessible on the command line.

How or why you think it is generally useful (i.e., not just for you)

To my experience command completion that "just works" is understood by many and makes applications easier to use without jumping back and forth between manpages or --help or just make it easier to discover options and that --help isn't just available at the top level. While many Syncthing users mostly use the Web GUI, the product may benefit from having command completion, particularly when considering features like decryption of folders.

What alternatives or workarounds you considered

  • Writing completers for Bash while starting at with minimal knowledge about how completers work and how to write good completers and keep them in sync with upstream.
  • Writing more scripts to workaround usability issues which I see solved in other projects like kubectl/chezmoi through helpful completers

Activity

  1. added
    enhancement
    needs-triage
    on Oct 22, 2022
  2. calmh commented on Oct 22, 2022

    @calmh
    Member
  3. changed the title [-]Consider adding CLI completion (cobra?)[/-] [+]Consider adding CLI completion[/+] on Mar 10, 2023
  4. removed
    needs-triage
    on Mar 10, 2023
  5. danpadcz commented on Oct 25, 2023

    @danpadcz
    Contributor

    Hey there, is anybody working on this feature? If not then I would like to work on it 😄

  6. added this to the v1.27.3 milestone on Jan 4, 2024
  7. changed the title [-]Consider adding CLI completion[/-] [+]Add CLI completion[/+] on Jan 8, 2024
  8. added a commit that references this issue on Jan 14, 2024
    b2ba185
  9. added a commit that references this issue on Jan 28, 2024
    9387e10
  10. ReillyBrogan commented on Feb 7, 2024

    @ReillyBrogan

    There doesn't seem to be any mechanism where a Linux package maintainer can generate shell completions ahead of time for supported shells. This seems to be a limitation of kongplete which only checks the users login shell to determine which shell to generate completions for (see this. Perhaps there's a different library out there that could be used instead?

  11. added
    frozen-due-to-age
    on Apr 9, 2025
  12. locked and limited conversation to collaborators on Apr 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementfrozen-due-to-age

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions