Repository: astral-sh/uv
File: crates/uv-cli/src/lib.rs (Rust)

Code before:
pub enum AuthCommand {
    /// Login to a service
    Login(AuthLoginArgs),
    /// Logout of a service
    Logout(AuthLogoutArgs),
    /// Show the authentication token for a service
    Token(AuthTokenArgs),
    /// Show the path to the uv credentials directory.
    ///
    /// By default, credentials are stored in the uv data directory at
    /// `$XDG_DATA_HOME/uv/credentials` or `$HOME/.local/share/uv/credentials` on Unix and
    /// `%APPDATA%\uv\data\credentials` on Windows.
    ///
    /// The credentials directory may be overridden with `$UV_CREDENTIALS_DIR`.
    ///
    /// Credentials are only stored in this directory when the plaintext backend is used, as
    /// opposed to the native backend, which uses the system keyring.
    Dir(AuthDirArgs),
    /// Act as a credential helper for external tools.
    ///
    /// Implements the Bazel credential helper protocol to provide credentials
    /// to external tools via JSON over stdin/stdout.
    ///
    /// This command is typically invoked by external tools, not directly by users.
    #[command(hide = true)]
    CredentialHelper(AuthCredentialHelperArgs),
}

#[derive(Args)]
pub struct ToolNamespace {
    #[command(subcommand)]
    pub command: ToolCommand,
}

#[derive(Subcommand)]
pub enum ToolCommand {
    /// Run a command provided by a Python package.
    ///
    /// By default, the package to install is assumed to match the command name.
    ///
    /// The name of the command can include an exact version in the format `<package>@<version>`,
    /// e.g., `uv tool run ruff@0.3.0`. If more complex version specification is desired or if the
    /// command is provided by a different package, use `--from`.
    ///
    /// `uvx` can be used to invoke Python, e.g., with `uvx python` or `uvx python@<version>`. A
    /// Python interpreter will be started in an isolated virtual environment.
    ///
    /// If the tool was previously installed, i.e., via `uv tool install`, the installed version
    /// will be used unless a version is requested or the `--isolated` flag is used.
    ///
    /// `uvx` is provided as a convenient alias for `uv tool run`, their behavior is identical.

Review comment (security):
I wonder if it should be `uv auth credential-helper` or `uv auth helper`? 🤔 

I know I suggested this, but can you remind me why this isn't just an output format for `uv auth token`?

Code after:

#[derive(Args)]
pub struct FormatArgs {
    /// Check if files are formatted without applying changes.
    #[arg(long)]
    pub check: bool,

    /// Show a diff of formatting changes without applying them.
    ///
    /// Implies `--check`.
    #[arg(long)]
    pub diff: bool,

    /// The version of Ruff to use for formatting.
    ///
    /// By default, a version of Ruff pinned by uv will be used.
    #[arg(long)]
    pub version: Option<String>,

    /// Additional arguments to pass to Ruff.
    ///
    /// For example, use `uv format -- --line-length 100` to set the line length or
    /// `uv format -- src/module/foo.py` to format a specific file.
    #[arg(last = true)]
    pub extra_args: Vec<String>,

    /// Avoid discovering a project or workspace.
    ///
    /// Instead of running the formatter in the context of the current project, run it in the
    /// context of the current directory. This is useful when the current directory is not a
    /// project.
    #[arg(long)]
    pub no_project: bool,
}

#[derive(Args)]
pub struct AuthNamespace {
    #[command(subcommand)]
    pub command: AuthCommand,
}

#[derive(Subcommand)]
pub enum AuthCommand {
    /// Login to a service
    Login(AuthLoginArgs),
    /// Logout of a service
    Logout(AuthLogoutArgs),
    /// Show the authentication token for a service
    Token(AuthTokenArgs),
    /// Show the path to the uv credentials directory.
    ///