Skip to content
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

Add missing cmd to nu command #1637

Merged
merged 1 commit into from
Nov 17, 2024
Merged

Conversation

Kissaki
Copy link
Contributor

@Kissaki Kissaki commented Nov 17, 2024

Add if defined expression via scope variables

Add if defined expression via `scope variables`
@fdncred fdncred merged commit 44c487c into nushell:main Nov 17, 2024
2 checks passed
@fdncred
Copy link
Collaborator

fdncred commented Nov 17, 2024

Thanks

@NotTheDr01ds
Copy link
Contributor

How about?

if '$<variable>' in (scope variables).name { <command> }

@Kissaki
Copy link
Contributor Author

Kissaki commented Nov 18, 2024

@NotTheDr01ds I see. Not having to define a closure arguably means simpler syntax.

I wasn't aware in could be used like that, with a list-collect+path-get.

I was thinking about potential performance differences as well, but it seems like (scope variables).name would or could be streaming data in the same way.

Overall, I don't think there's a clear winner. They're alternative query approaches. Makes me wonder if adding both alternatives would make sense.

@fdncred
Copy link
Collaborator

fdncred commented Nov 18, 2024

I do think this is more nushell idiomatic. This example should probably be updated.

'$rn' in (scope variables).name

Kissaki added a commit to Kissaki/nushell.github.io that referenced this pull request Nov 18, 2024
Follow-up to nushell#1637 as per discussion
@Kissaki
Copy link
Contributor Author

Kissaki commented Nov 18, 2024

I created #1643 for it.

fdncred pushed a commit that referenced this pull request Nov 18, 2024
Follow-up to #1637 as per discussion
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