Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions crates/uv-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,15 @@ pub enum PythonListFormat {
Json,
}

#[derive(Debug, Default, Clone, Copy, clap::ValueEnum)]
pub enum SyncFormat {
/// Display the result in a human-readable format.
#[default]
Text,
/// Display the result in JSON format.
Json,
}

#[derive(Debug, Default, Clone, clap::ValueEnum)]
pub enum ListFormat {
/// Display the list of packages in a human-readable table.
Expand Down Expand Up @@ -3163,6 +3172,10 @@ pub struct SyncArgs {
#[arg(long, conflicts_with = "all_extras", value_parser = extra_name_with_clap_error)]
pub extra: Option<Vec<ExtraName>>,

/// Select the output format.
#[arg(long, value_enum, default_value_t = SyncFormat::default())]
pub output_format: SyncFormat,

/// Include all optional dependencies.
///
/// When two or more extras are declared as conflicting in `tool.uv.conflicts`, using this flag
Expand Down
6 changes: 6 additions & 0 deletions crates/uv-fs/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,12 @@ impl From<Box<Path>> for PortablePathBuf {
}
}

impl<'a> From<&'a Path> for PortablePathBuf {
fn from(path: &'a Path) -> Self {
Box::<Path>::from(path).into()
}
}

#[cfg(feature = "serde")]
impl serde::Serialize for PortablePathBuf {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
Expand Down
16 changes: 16 additions & 0 deletions crates/uv/src/commands/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1406,6 +1406,14 @@ impl ProjectEnvironment {
Self::WouldCreate(..) => Err(ProjectError::DroppedEnvironment),
}
}

/// Return the path to the actual target, if this was a dry run environment.
pub(crate) fn dry_run_target(&self) -> Option<&Path> {
match self {
Self::WouldReplace(path, _, _) | Self::WouldCreate(path, _, _) => Some(path),
Self::Created(_) | Self::Existing(_) | Self::Replaced(_) => None,
}
}
}

impl std::ops::Deref for ProjectEnvironment {
Expand Down Expand Up @@ -1586,6 +1594,14 @@ impl ScriptEnvironment {
Self::WouldCreate(..) => Err(ProjectError::DroppedEnvironment),
}
}

/// Return the path to the actual target, if this was a dry run environment.
pub(crate) fn dry_run_target(&self) -> Option<&Path> {
match self {
Self::WouldReplace(path, _, _) | Self::WouldCreate(path, _, _) => Some(path),
Self::Created(_) | Self::Existing(_) | Self::Replaced(_) => None,
}
}
}

impl std::ops::Deref for ScriptEnvironment {
Expand Down
Loading
Loading