use std::path::PathBuf;
use clap::builder::{NonEmptyStringValueParser, PathBufValueParser};
use release_plz_core::ReleaseRequest;
use secrecy::SecretString;
use super::local_manifest;
#[derive(clap::Parser, Debug)]
pub struct Release {
#[clap(long, value_parser = PathBufValueParser::new())]
project_manifest: Option<PathBuf>,
#[clap(long)]
registry: Option<String>,
#[clap(long, value_parser = NonEmptyStringValueParser::new())]
token: Option<String>,
#[clap(long)]
pub dry_run: bool,
#[clap(long)]
pub git_release: bool,
#[clap(long, value_parser = NonEmptyStringValueParser::new())]
pub repo_url: Option<String>,
#[clap(long, value_parser = NonEmptyStringValueParser::new())]
pub git_token: String,
}
impl From<Release> for ReleaseRequest {
fn from(r: Release) -> Self {
ReleaseRequest {
local_manifest: local_manifest(r.project_manifest.as_deref()),
registry: r.registry,
token: r.token.map(SecretString::from),
dry_run: r.dry_run,
git_release: r.git_release,
repo_url: r.repo_url,
git_token: SecretString::from(r.git_token),
}
}
}