Skip to content

Conversation

@rami3l
Copy link
Member

@rami3l rami3l commented Nov 21, 2025

@rami3l rami3l requested review from ChrisDenton and djc November 21, 2025 20:56
@rami3l rami3l force-pushed the cli/nushell-completion branch 2 times, most recently from ad09574 to 89d74ec Compare November 21, 2025 21:17
}

#[derive(clap::ValueEnum, Clone, Copy, Debug)]
enum CompletionShell {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems pretty unclear from the code why this needs to be a separate enum rather than another variant added to Shell? Should at least clarify in a comment/docstring.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shell is an external enum so cannot be extended. Do you have some other ideas regarding the extension of such a type? Will nested enums be better in your opinion?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@epage why is this a separate crate? Seems like a pain in the ass for downstreams?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PS: When I say this PR mirrors the jj one that's because jj has also flattened the enum like this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is this a separate crate? Seems like a pain in the ass for downstreams?

There are two distinctions

  • In clap_complete or not
  • In Shell or not

Looking back in the past, I wish we had fewer shells in Shell then we do and in the next major version would like to trim it down and locking it down. imo we shouldn't be implicitly extending the compatibility surface of our callers by adding new content to Shell. Pulling in esoteric shells like elvish and fig should be explicit choices. Where the line is for what should be in clap_complete or even in Shell is not yet determined.

See also

At least with our new completion system, it is easier to add new shells, see https://docs.rs/clap_complete/latest/clap_complete/env/struct.Shells.html

Would be willing to explore something similar for our existing completion system.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe there shouldn't be an enum at all, only a trait?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add nushell completion support

3 participants