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

Make --directory a global argument #5579

Merged
merged 1 commit into from
Jul 29, 2024
Merged

Make --directory a global argument #5579

merged 1 commit into from
Jul 29, 2024

Conversation

charliermarsh
Copy link
Member

Summary

Cargo makes this global (and uses the same technique). It's still hidden so we can always decide to remove it.

@charliermarsh charliermarsh added cli Related to the command line interface preview Experimental behavior labels Jul 29, 2024
@charliermarsh charliermarsh marked this pull request as ready for review July 29, 2024 23:33
@charliermarsh charliermarsh merged commit c46adee into main Jul 29, 2024
57 checks passed
@charliermarsh charliermarsh deleted the charlie/directory branch July 29, 2024 23:43
@bluss
Copy link
Contributor

bluss commented Jul 29, 2024

Changing directory is a different thing and makes uv run harder to use like that (if you pass relative paths to an uv run command, it might not work so well.)

@charliermarsh
Copy link
Member Author

What's harder about it? Why is it wrong to resolve paths relative to the provided directory?

@charliermarsh
Copy link
Member Author

(I mean, it's easy to change -- we just track a current directory globally in uv-fs, add a setter, and always read from there rather than using CWD.)

@bluss
Copy link
Contributor

bluss commented Jul 29, 2024

I'm thinking that you have something like

$ uv --directory path/to/proj run the_command --flag ./myfile.txt
# <------- uv run part ---------> <-- regular command part  ---->

Ideally the uv run part should just be transparent. It brings forth the environment in where the program executes. The regular command line part of the command shouldn't have to change.

One reason why it's wrong to resolve myfile.txt relative to the given directory is that the user probably autocompleted it from their current directory. It's hard to use interactively (and hard to use in scripts as well, except there you'd probably just have to remember to abspath everything.)

@charliermarsh
Copy link
Member Author

That makes sense. I can change it up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command line interface preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants