-
Notifications
You must be signed in to change notification settings - Fork 438
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
Document how to alias subexpressions #998
Comments
This feature is recently removed in this release, now alias can't have pipes in it. alternative would be to define a function like
|
alias nn = do {$env.HOME | path join bin n} |
I just tried that, but when why run |
I see! So you wanted an "escape to the system", not aliasable subexpressions. TL;DR: You can use alias nn = ^($env.HOME | path join bin n) That caret (^) interprets the string that follows it as a given path to an external call. For example |
Yes, that works. I don't get what the difference is, though. alias tf = terraform I also noticed I can alias to the full path: alias tf2 = /path/to/terraform Then why do I need the Also, I believe my original question is resolved, but I also think this information should be in the docs, as this is a common requirement, to alias to a dynamic path, like a subdir in the home directory. |
Glad that worked! The difference lies where Nushell tries to be a full-fledged programming language (cf. Thinking in Nu), with its data fully typed and flowing through the pipe in a structured manner. Therefore The caret exists probably because Nushell wants to retain (some) compatibility with the POSIX-ish approach of putting executables in PATH. For example, Nushell has a builtin
Totally agree. I'd love to help with the docs, but I'm by no means familiar with the relevant source code 😢 Oh, and (Updated: In Nu 0.83 there can only be |
@mksinicus I changed the title and description to make this an issue about docs. |
@giggio |
maybe this issue should be moved to https://github.com/nushell/nushell.github.io? |
@amtoine yes, I agree. Is there a way to move automatically or we close it here and reopen it there? |
this is how it's done @giggio 😉 |
Related problem
Docs should show how to alias subexpressions.
Describe the solution you'd like
For example:
Describe alternatives you've considered
N/A
Additional context and details
No response
The text was updated successfully, but these errors were encountered: