Skip to content

Commit

Permalink
Unhide the --directory option (#7653)
Browse files Browse the repository at this point in the history
  • Loading branch information
zanieb authored Sep 24, 2024
1 parent 5da73a2 commit 0c6117f
Show file tree
Hide file tree
Showing 3 changed files with 337 additions and 2 deletions.
8 changes: 7 additions & 1 deletion crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,11 @@ pub struct GlobalArgs {
pub no_progress: bool,

/// Change to the given directory prior to running the command.
#[arg(global = true, long, hide = true)]
///
/// Relative paths are resolved with the given directory as the base.
///
/// See `--project` to only change the project root directory.
#[arg(global = true, long)]
pub directory: Option<PathBuf>,

/// Run the command within the given project directory.
Expand All @@ -246,6 +250,8 @@ pub struct GlobalArgs {
/// Other command-line arguments (such as relative paths) will be resolved relative
/// to the current working directory.
///
/// See `--directory` to change the working directory entirely.
///
/// This setting has no effect when used in the `uv pip` interface.
#[arg(global = true, long)]
pub project: Option<PathBuf>,
Expand Down
25 changes: 25 additions & 0 deletions crates/uv/tests/help.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ fn help() {
certificate store [env: UV_NATIVE_TLS=]
--offline Disable network access
--no-progress Hide all progress outputs
--directory <DIRECTORY> Change to the given directory prior to running the command
--project <PROJECT> Run the command within the given project directory
--config-file <CONFIG_FILE> The path to a `uv.toml` file to use for configuration [env:
UV_CONFIG_FILE=]
Expand Down Expand Up @@ -122,6 +123,7 @@ fn help_flag() {
certificate store [env: UV_NATIVE_TLS=]
--offline Disable network access
--no-progress Hide all progress outputs
--directory <DIRECTORY> Change to the given directory prior to running the command
--project <PROJECT> Run the command within the given project directory
--config-file <CONFIG_FILE> The path to a `uv.toml` file to use for configuration [env:
UV_CONFIG_FILE=]
Expand Down Expand Up @@ -187,6 +189,7 @@ fn help_short_flag() {
certificate store [env: UV_NATIVE_TLS=]
--offline Disable network access
--no-progress Hide all progress outputs
--directory <DIRECTORY> Change to the given directory prior to running the command
--project <PROJECT> Run the command within the given project directory
--config-file <CONFIG_FILE> The path to a `uv.toml` file to use for configuration [env:
UV_CONFIG_FILE=]
Expand Down Expand Up @@ -339,6 +342,13 @@ fn help_subcommand() {
For example, spinners or progress bars.
--directory <DIRECTORY>
Change to the given directory prior to running the command.
Relative paths are resolved with the given directory as the base.
See `--project` to only change the project root directory.
--project <PROJECT>
Run the command within the given project directory.
Expand All @@ -349,6 +359,8 @@ fn help_subcommand() {
Other command-line arguments (such as relative paths) will be resolved relative to the
current working directory.
See `--directory` to change the working directory entirely.
This setting has no effect when used in the `uv pip` interface.
--config-file <CONFIG_FILE>
Expand Down Expand Up @@ -500,6 +512,13 @@ fn help_subsubcommand() {
For example, spinners or progress bars.
--directory <DIRECTORY>
Change to the given directory prior to running the command.
Relative paths are resolved with the given directory as the base.
See `--project` to only change the project root directory.
--project <PROJECT>
Run the command within the given project directory.
Expand All @@ -510,6 +529,8 @@ fn help_subsubcommand() {
Other command-line arguments (such as relative paths) will be resolved relative to the
current working directory.
See `--directory` to change the working directory entirely.
This setting has no effect when used in the `uv pip` interface.
--config-file <CONFIG_FILE>
Expand Down Expand Up @@ -580,6 +601,7 @@ fn help_flag_subcommand() {
certificate store [env: UV_NATIVE_TLS=]
--offline Disable network access
--no-progress Hide all progress outputs
--directory <DIRECTORY> Change to the given directory prior to running the command
--project <PROJECT> Run the command within the given project directory
--config-file <CONFIG_FILE> The path to a `uv.toml` file to use for configuration [env:
UV_CONFIG_FILE=]
Expand Down Expand Up @@ -633,6 +655,7 @@ fn help_flag_subsubcommand() {
certificate store [env: UV_NATIVE_TLS=]
--offline Disable network access
--no-progress Hide all progress outputs
--directory <DIRECTORY> Change to the given directory prior to running the command
--project <PROJECT> Run the command within the given project directory
--config-file <CONFIG_FILE> The path to a `uv.toml` file to use for configuration [env:
UV_CONFIG_FILE=]
Expand Down Expand Up @@ -775,6 +798,7 @@ fn help_with_global_option() {
certificate store [env: UV_NATIVE_TLS=]
--offline Disable network access
--no-progress Hide all progress outputs
--directory <DIRECTORY> Change to the given directory prior to running the command
--project <PROJECT> Run the command within the given project directory
--config-file <CONFIG_FILE> The path to a `uv.toml` file to use for configuration [env:
UV_CONFIG_FILE=]
Expand Down Expand Up @@ -878,6 +902,7 @@ fn help_with_no_pager() {
certificate store [env: UV_NATIVE_TLS=]
--offline Disable network access
--no-progress Hide all progress outputs
--directory <DIRECTORY> Change to the given directory prior to running the command
--project <PROJECT> Run the command within the given project directory
--config-file <CONFIG_FILE> The path to a `uv.toml` file to use for configuration [env:
UV_CONFIG_FILE=]
Expand Down
Loading

0 comments on commit 0c6117f

Please sign in to comment.