Comments (8)
To provide some context, lf
(a file manager) has a command line where text can be sent to a shell for execution. The following lines of code show how the shell arguments are built: https://github.com/gokcehan/lf/blob/0c02239b177a14526b84df41a07405c685cedaba/os.go#L142-L146
The resulting invocation looks roughly like this:
<shell> -c <script_contents> -- [args]...
This works nicely for POSIX-compliant shells, but not for nushell
. I am not sure about the motivation however, since I think this doesn't fall under 'normal usage' requirements.
from nushell.
Ran into some similar problems with fzf
passing a preview command-line to nu
. In that case, it was differences in quoting between POSIX/Fish vs. Nushell.
I think there's a case to be made for providing some commonality with other shells in the way Nushell is invoked at least.
from nushell.
The last time we talked about this I thought that def --wrapped
custom commands would suffice. I could be remembering wrong though. For what it's worth, I'd probably support something like nu -c 'echo $argv' -- foo bar
because it's pretty widely used, although others may not.
Also, saying posix shells do x is not a real motivating factor for nushell to do anything since we have never planned on being posix compliant. However, we do want nushell to feel comfortable and "at home" to a certain degree, but that definitely doesn't mean implementing everything a posix shell does. Sometimes keeping muscle memory is good. Other times we should just learn something new.
This is how def --wrapped
works. It allows you to pass most anything through
❯ def --wrapped test [...args] { print ...$args }
❯ test -- a b c
--
a
b
c
from nushell.
@fdncred Sure, I didn't mean that nushell
should obey the posix standard, I believe it is too old and should have been renewed a long time ago.
My feeling is more like: look, even good old Posix shell has it covered 😄, and nushell
doesn't seem to be supporting such a use case at all.
I may not understand the def --wrapped
correctly, but it doesn't seem to be working:
So, I think we all agree that it is a good thing to have, I will be working on the feature maybe next week, it could take a while since I am new to the project and Rust 😄
from nushell.
Ok, as long as it doesn't interfere with params being passed to scripts. I'm pretty sure this is allowed now like nu script.nu param1 param2
where param1 and param2 are passed into script.nu as parameters. I could be remembering wrong though. Seems like it wouldn't interfere, but we just don't want to break existing functionality.
from nushell.
@fdncred Would you like to take a look at the issue and share your thoughts? I would like to work on it if we are on the same page.
from nushell.
You're trying to pass -- foo bar
to nu
, not the tmp
custom command which is fine, but my example was for custom commands supporting those flags, not the nushell executable. The nushell executable does not support it and it would have to be added via rust code.
from nushell.
@fdncred Yes, you are correct. I just wanted to make sure we are on the same page. I would try to add the support to the double dash --
for the nu
executable, and the temp custom command example you showed is a good pointer for the implementation.
from nushell.
Related Issues (20)
- After modifying the nushell prompt, certain situations lead to the prompt being printed abnormally. HOT 1
- `explore` should be faster on large tables HOT 2
- New shell_integration config won't parse HOT 3
- Can't interrupt `open` on CSV files HOT 2
- Should official install-included plugins be available through `$env.NU_PLUGIN_DIRS`?
- `go install -ldflags="options"` works in `0.94.0` but not in `0.94.1`, `0.94.2` HOT 1
- Copy (ctrl+c. ctrl+shift+c) does not work in Vim or ignored HOT 2
- Error: nu::shell::column_not_found > $env.config = ($env.config | upsert render_right_prompt_on_last_line true) HOT 3
- `SyntaxShape::OneOf` does not work for named arguments
- 0.94.x `str substring` regression with negative end-offset HOT 1
- mv should error when attempting to move folders into itself HOT 3
- More consistent database commands HOT 1
- Nushell infinitely consumes memory opening some sqlite files HOT 5
- Error throws when changing directory to root folder of a Windows drive without trailing backslash HOT 2
- Kitty shows a desktop notification every time a directory is entered with `shell_integration: { osc9_9: true }` HOT 7
- `touch` doesn't have a `-d` flag despite it being used in documentation examples HOT 1
- Rename `for --numbered` to `for --enumerate` (or deprecate entirely?) HOT 7
- Double-slash (`//`) after tilde (`~`) symbol in WD before command HOT 2
- Can't define table header with variable name HOT 5
- input command doesn't work when running nu as a subprocess
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nushell.