Skip to content

Simplify external completer #1049

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

JoaquinTrinanes
Copy link
Contributor

This PR modernizes the external completer docs by using match instead of { ... } | get -i ... | default ....

It's:

  • Simpler to read and understand
  • A nice way to get folks reading the docs to learn about match (<3)
  • A textbook example of when to use match

Copy link
Member

@sholderbach sholderbach left a comment

Choose a reason for hiding this comment

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

Nice! It's a match ❤️

@sholderbach sholderbach merged commit c2498f4 into nushell:main Sep 7, 2023
@JoaquinTrinanes JoaquinTrinanes deleted the simplify-external-completer branch September 7, 2023 22:40
@rgwood
Copy link
Contributor

rgwood commented Sep 8, 2023

Nice improvement, thanks!


{
match {
Copy link
Contributor

Choose a reason for hiding this comment

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

What is match matching on here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oops, that's a typo. It should be match $spans.0 :)

I'll create a followup PR soon when I have time

@fdncred
Copy link
Contributor

fdncred commented Sep 9, 2023

@JoaquinTrinanes Can you please take a look at my comment above. I was trying out this cleanup and noticed that match isn't matching on anything.

I tried the way it is and get an error, then I tried this and just can't get it to work

    match spans.0 {
        "z" | "zi" => $zoxide_completer
        "nu" => $fish_completer
        "git" => $carapace_completer
        _ => $carapace_completer
    }

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.

4 participants