Skip to content

jc: add completions and README#1144

Merged
fdncred merged 6 commits into
nushell:mainfrom
RGBCube:jc
Jul 18, 2025
Merged

jc: add completions and README#1144
fdncred merged 6 commits into
nushell:mainfrom
RGBCube:jc

Conversation

@RGBCube

@RGBCube RGBCube commented Jul 18, 2025

Copy link
Copy Markdown
Contributor
image

Errors:

image

@weirdan weirdan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there any chance to add magic command support too? You can run jc df instead of df | jc --df, but these completions won't suggest that.

Comment thread modules/jc/README.md
@RGBCube

RGBCube commented Jul 18, 2025

Copy link
Copy Markdown
Contributor Author

Yup: ^jc --about | from json | get parsers | each { $in.magic_commands? } | flatten

Didn't know about magic_commands, cool!

@RGBCube

RGBCube commented Jul 18, 2025

Copy link
Copy Markdown
Contributor Author

Almost done, I now just want to make the magic commands appear fist

@RGBCube

RGBCube commented Jul 18, 2025

Copy link
Copy Markdown
Contributor Author

Seems like that's not a thing we can control. Oh well

@RGBCube

RGBCube commented Jul 18, 2025

Copy link
Copy Markdown
Contributor Author

Hmm, actually I can just filter based on the current input and not show the "-"

@RGBCube

RGBCube commented Jul 18, 2025

Copy link
Copy Markdown
Contributor Author

Works well now, but I removed the caching using $env as it wasn't working, and it's pretty slow to complete and recomplete. Any suggestions on caching it properly?

@RGBCube

RGBCube commented Jul 18, 2025

Copy link
Copy Markdown
Contributor Author

Managed to do it well using stor, neat!

@RGBCube

RGBCube commented Jul 18, 2025

Copy link
Copy Markdown
Contributor Author

Oops, there's a mistake where we memoize ones that don't contain "-"

@RGBCube

RGBCube commented Jul 18, 2025

Copy link
Copy Markdown
Contributor Author

Ready to merge now, would love to see if it works for you also @weirdan

@weirdan weirdan left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

jc gi<tab> produces invalid completions (ought to include git ls-remote), but I can live with that.

@fdncred

fdncred commented Jul 18, 2025

Copy link
Copy Markdown
Contributor

cool. thanks!

@fdncred
fdncred merged commit c8c912c into nushell:main Jul 18, 2025
1 check passed
@RGBCube

RGBCube commented Jul 18, 2025

Copy link
Copy Markdown
Contributor Author

jc gi<tab> produces invalid completions (ought to include git ls-remote), but I can live with that.

image

The completions exist, but the thing I've noticed is that partial-completions don't really work great (which is what happens when you press gi<tab>, as it fills:

Screen.Recording.2025-07-19.at.01.15.22.mov

Not sure if this is the fault of the completer though, probably the shell as it isn't quoting for some reason

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.

3 participants