-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
expose argv[0] as $env.PROCESS_PATH
#11203
Conversation
even if we don't reach a consensus on this, i'd like to at least fix this: #11059 (comment), so pointers would be appreciated |
ORIGINAL_CMDLINE infers the command and all the parameters, is that how it works? |
No, it's already there (all the way back from nu's This is why ORIGINAL_CMDLINE is a bad name @fdncred edited^^^ |
ok, I don't really like ORIGINAL_CMDLINE so I'm throwing out some others.
I'm kind of leaning towards PROCESS_PATH, any takers? |
Same |
When the name bikeshedding is done let's update the title to make the commit better discoverable. |
@sholderbach does the pr title look good? |
Thanks! 👍 |
also, when a script has a
the error message (last line) should also use this process path instead of Where is the code for this? |
Let's handle the "main" part in another PR. My suggestion would be to search for "main" in the code and MissingPositional to see where they're used. Seems like this is what's being called. You may be able to track it down from here. nushell/crates/nu-protocol/src/parse_error.rs Lines 341 to 347 in 5d28375
|
@p00f |
@amtoine fixed it |
closes nushell#11059 # Description I'm not sure what the consensus was after discussing this in discord, so I'm creating a PR as suggested # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> TBD # Tests + Formatting TBD <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use std testing; testing run-tests --path crates/nu-std"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting TBD <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. -->
closes nushell#11059 # Description I'm not sure what the consensus was after discussing this in discord, so I'm creating a PR as suggested # User-Facing Changes <!-- List of all changes that impact the user experience here. This helps us keep track of breaking changes. --> TBD # Tests + Formatting TBD <!-- Don't forget to add tests that cover your changes. Make sure you've run and fixed any issues with these commands: - `cargo fmt --all -- --check` to check standard code formatting (`cargo fmt --all` applies these changes) - `cargo clippy --workspace -- -D warnings -D clippy::unwrap_used` to check that you're using the standard code style - `cargo test --workspace` to check that all tests pass (on Windows make sure to [enable developer mode](https://learn.microsoft.com/en-us/windows/apps/get-started/developer-mode-features-and-debugging)) - `cargo run -- -c "use std testing; testing run-tests --path crates/nu-std"` to run the tests for the standard library > **Note** > from `nushell` you can also use the `toolkit` as follows > ```bash > use toolkit.nu # or use an `env_change` hook to activate it automatically > toolkit check pr > ``` --> # After Submitting TBD <!-- If your PR had any user-facing changes, update [the documentation](https://github.com/nushell/nushell.github.io) after the PR is merged, if necessary. This will help us keep the docs up to date. -->
closes #11059
Description
I'm not sure what the consensus was after discussing this in discord, so I'm creating a PR as suggested
User-Facing Changes
$env.PROCESS_PATH
can now be used in scripts to get the name the script was invoked withTests + Formatting
After Submitting