Skip to content

FR: add a subcommand for generating completions #313

Open

Description

@ethanpailes

Apparently clap can do this automatically. We should look into setting it up and then add a usage section about how to set completions up.

discussion with some more context: #289

Activity

  1. ethanpailes commented on Feb 11, 2026

    @ethanpailes
    ContributorAuthor

    This issue is pretty stand alone, so it would be a good one to start with if someone wanted to take it on. Does not really require knowing anything about shpool's internals.

  2. injust commented on Feb 11, 2026

    @injust

    See fish-shell/fish-shell#12302 (comment) for a suggested patch (in the collapsible "Details" section).

  3. ethanpailes commented on Feb 11, 2026

    @ethanpailes
    ContributorAuthor

    I haven't reviewed that patch super closely, but I think I noticed some use of unstable features, which makes me uncomfortable. shpool is maintained on a best-effort basis and I don't want to be in a position where the only options are dropping a feature and breaking backwards compatibility or re-implementing a now-deprecated or dropped feature that an upstream library decided to abandon. Maybe it's possible to use clap's completion support without relying on unstable features though.

  4. krobelus commented on Feb 12, 2026

    @krobelus

    Right, clap's dynamic completions are still unstable.
    Dynamic means that the shell will run something like SHPOOL_COMPLETE=fish shpool -- $arg1 $arg2 to compute completions,
    i.e. it more or less minimizes shell-specific code.
    IIRC clap's static completions are stable and can generate completions for --someflag but I don't think they can complete session names.
    But that can be provided with a little bit of shell-specific glue logic, so I don't see a blocker to using static completions for now.

    I haven't worked on it yet because I wanted a more general solution clap-rs/clap#5784 .. but static completions would be a strict improvement, and we could even keep the interface stable when we move to dynamic ones later.

  5. ethanpailes commented on Mar 2, 2026

    @ethanpailes
    ContributorAuthor

    Sounds like static completions for now and then dynamic completions once those are stable in clap is the way to go then.

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions