Skip to content

Commit

Permalink
Allow specifying script commands relative to the project root
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
brandon-avantus committed Aug 12, 2024
1 parent 53fdc7d commit 5bb584a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions rye/src/cli/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ fn invoke_script(
.map(OsString::from)
.chain(args.into_iter().skip(1))
.collect();

let path = std::path::Path::new(&args[0]);
if path.starts_with("./") {
args[0] = pyproject.root_path().join(path).into();
}
}
}
Some(Script::External(_)) => {
Expand Down

0 comments on commit 5bb584a

Please sign in to comment.