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

PROCESS_PATH is not a path, more like a call name #11357

Open
bew opened this issue Dec 17, 2023 · 10 comments
Open

PROCESS_PATH is not a path, more like a call name #11357

bew opened this issue Dec 17, 2023 · 10 comments
Labels
enhancement New feature or request needs-triage An issue that hasn't had any proper look

Comments

@bew
Copy link

bew commented Dec 17, 2023

Related problem

Reading the release notes about this new variable, I'm confused by the naming ..._PATH even though the value is not a path that can be used from anywhere.

When I have the path of something I expect to be able to:

  1. manipulate like a path, e.g. navigate through its parent dirs
  2. call it from anywhere

At the moment we have none of these with values like demo.nu or ./demo.nu

Describe the solution you'd like

Have PROCESS_PATH be the actual path to the process, so calling the release note example would give:

demo.nu
./demo.nu
/path/to/demo.nu
# all 3 examples show as "I was called as /path/to/demo.nu"

Have PROCESS_CALL_NAME with the current behavior of PROCESS_PATH

Describe alternatives you've considered

Compute the actual path based on how the current value looks like, but it's still be confusing

Additional context and details

No response

@bew bew added enhancement New feature or request needs-triage An issue that hasn't had any proper look labels Dec 17, 2023
@bew bew changed the title PROCESS_PATH is not a path, more like a PROCESS_PATH is not a path, more like a call name Dec 17, 2023
@amtoine
Copy link
Member

amtoine commented Dec 18, 2023

it was added in #11203 and yeah, sounds a bit confusing that it's not a path 🤔

i think the two directions you propose are good

  • rename it to something like $env.CALL_NAME or $env.PROCESS_CALL_NAME
  • make $env.PROCESS_PATH be a real absolute path to the script that is being called

@p00f, could you have a look into one of these? 😇
i feel like the latter would be more useful even if it's not 100% what argv[0] means usually, but sounds a bit more Nushell-y to me 😋

@p00f
Copy link
Contributor

p00f commented Dec 18, 2023

rename it to something like $env.CALL_NAME or $env.PROCESS_CALL_NAME

sure

make $env.PROCESS_PATH be a real absolute path to the script that is being called

No

  1. this already exists as $env.CURRENT_FILE
  2. i added this because i did need "100% what argv[0] means usually" 😄

@p00f
Copy link
Contributor

p00f commented Dec 18, 2023

BTW anyone can do this - you only have to grep for PROCESS_PATH, there's only one occurrence

@amtoine
Copy link
Member

amtoine commented Dec 18, 2023

@bew
renaming it to $env.PROCESS_CALL_NAME and keeping the same behaviour sounds better then 😋

@bew
Copy link
Author

bew commented Dec 18, 2023

  1. this already exists as $env.CURRENT_FILE

Hmm, if it's always a path what about renaming it to $env.CURRENT_FILE_PATH 🤔

(I left my dev laptop home for a few days/week, won't be able to make a PR anytime soon, I could do it from my phone though 👀)

@p00f
Copy link
Contributor

p00f commented Dec 18, 2023

Hmm, if it's always a path what about renaming it to $env.CURRENT_FILE_PATH 🤔

this one's been there for a while, let's not change it

i'll change PROCESS_PATH once everyone agrees

@amtoine
Copy link
Member

amtoine commented Dec 19, 2023

@p00f
i think renaming $env.PROCESS_PATH to something like $env.PROCESS_CALL_NAME would be nice 👌

@fdncred
Copy link
Collaborator

fdncred commented Dec 19, 2023

What's a process call name? That's more confusing. You guys are just making stuff up again. 😆

We discussed here #11203 (comment) already. $env.IT_SHOULD_BE_NAMED_ARGV0

It could indeed be a path like this one. So, saying it's not a path is incorrect. It depends on how it's called.

/tmp/workspaces/0PMKZ: ./foo
I was called as ./foo

@p00f
Copy link
Contributor

p00f commented Dec 19, 2023

Fully agree @fdncred

@p00f
Copy link
Contributor

p00f commented Jan 8, 2024

I think this can be closed - $env.CURRENT_FILE is the "actual" path

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request needs-triage An issue that hasn't had any proper look
Projects
None yet
Development

No branches or pull requests

4 participants