Skip to content

Support self update --output-format=json #14459

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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 @@ -58,6 +58,15 @@ pub enum ListFormat {
Json,
}

#[derive(Debug, Default, Clone, Copy, clap::ValueEnum)]
pub enum SelfUpdateFormat {
/// Output plain text messages.
#[default]
Text,
/// Output result as JSON.
Json,
}

fn extra_name_with_clap_error(arg: &str) -> Result<ExtraName> {
ExtraName::from_str(arg).map_err(|_err| {
anyhow!(
Expand Down Expand Up @@ -651,6 +660,10 @@ pub struct SelfUpdateArgs {
/// Run without performing the update.
#[arg(long)]
pub dry_run: bool,

/// The format in which the result would be displayed.
#[arg(long, value_enum, default_value_t = SelfUpdateFormat::default())]
pub output_format: SelfUpdateFormat,
}

#[derive(Args)]
Expand Down
Loading
Loading