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

Allow specifying script commands relative to the project root #1328

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

brandon-avantus
Copy link

Command paths with a leading ./ have the project root prepended, which allows scripts in the project tree to be used with rye run even when the current directory is not the project root.

Command paths with a leading `./` have the project root prepended, which
allows scripts in the project tree to be used with `rye run` even when
the current directory is not the project root.

let path = std::path::Path::new(&args[0]);
if path.starts_with("./") {
args[0] = pyproject.root_path().join(path).into();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should just always join this, since if path is absolute, joining just resolves to path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants