use std::path::PathBuf; use clap::Args; use crate::stage0_config::{ PleaseConfigBuilder, PleaseProjectConfigBuilder, PleaseSettingsConfigBuilder, }; #[derive(Args, Debug, Clone)] pub struct ConfigArgs { /// Which repository to publish against. If not supplied remote url will be inferred from environment or fail if not present. #[arg( env = "CUDDLE_PLEASE_API_URL", long, global = true, help_heading = "Config" )] pub api_url: Option, /// repo is the name of repository you want to release for #[arg( env = "CUDDLE_PLEASE_REPO", long, global = true, help_heading = "Config" )] pub repo: Option, /// owner is the name of user from which the repository belongs / #[arg( env = "CUDDLE_PLEASE_OWNER", long, global = true, help_heading = "Config" )] pub owner: Option, /// which source directory to use, if not set `std::env::current_dir` is used instead. #[arg( env = "CUDDLE_PLEASE_SOURCE", long, global = true, help_heading = "Config" )] pub source: Option, /// which branch is being run from #[arg( env = "CUDDLE_PLEASE_BRANCH", long, global = true, help_heading = "Config" )] pub branch: Option, /// which git username to use for commits #[arg( env = "CUDDLE_PLEASE_GIT_USERNAME", long, global = true, help_heading = "Config" )] pub git_username: Option, /// which git email to use for commits #[arg( env = "CUDDLE_PLEASE_GIT_EMAIL", long, global = true, help_heading = "Config" )] pub git_email: Option, } impl From for PleaseConfigBuilder { fn from(value: ConfigArgs) -> Self { Self { project: Some(PleaseProjectConfigBuilder { owner: value.owner, repository: value.repo, source: value.source, branch: value.branch, }), settings: Some(PleaseSettingsConfigBuilder { api_url: value.api_url, git_username: value.git_username, git_email: value.git_email, }), } } }