feat(clap): add force, unlink flags

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
This commit is contained in:
Christina Sørensen 2023-10-16 18:46:23 +02:00
parent b1a0c99264
commit cea9a4eb43
Signed by: cafkafk
GPG key ID: 26C542FD97F965CE
3 changed files with 15 additions and 1 deletions

View file

@ -36,7 +36,7 @@ const HELP_TEMPLATE: &str = "\
//#[clap(author, version, about, long_about = None)] //#[clap(author, version, about, long_about = None)]
#[derive(Parser, Debug)] #[derive(Parser, Debug)]
#[clap( #[clap(
name="seidr - git gut", name="seidr - declarative linkfarm",
author, author,
version, version,
long_version=env!("CARGO_PKG_VERSION"), long_version=env!("CARGO_PKG_VERSION"),
@ -72,6 +72,14 @@ pub struct Args {
#[arg(short, long)] #[arg(short, long)]
pub no_emoji: bool, pub no_emoji: bool,
/// (not imlemented)
#[arg(short, long)]
pub unlink: bool,
/// (not imlemented)
#[arg(short, long)]
pub force: bool,
#[arg(short, long)] #[arg(short, long)]
pub message: Option<String>, pub message: Option<String>,

View file

@ -72,6 +72,8 @@ fn main() {
args if args.code_of_conduct => println!("{}", utils::strings::INTERACTIVE_COC), args if args.code_of_conduct => println!("{}", utils::strings::INTERACTIVE_COC),
args if args.quiet => settings::QUIET.store(true, Ordering::Relaxed), args if args.quiet => settings::QUIET.store(true, Ordering::Relaxed),
args if args.no_emoji => settings::EMOJIS.store(true, Ordering::Relaxed), args if args.no_emoji => settings::EMOJIS.store(true, Ordering::Relaxed),
args if args.unlink => settings::UNLINK.store(true, Ordering::Relaxed),
args if args.force => settings::FORCE.store(true, Ordering::Relaxed),
args if args.message.is_some() => message_input = args.message.clone().unwrap(), args if args.message.is_some() => message_input = args.message.clone().unwrap(),
_ => (), _ => (),
} }

View file

@ -3,3 +3,7 @@ use std::sync::atomic::AtomicBool;
pub static QUIET: AtomicBool = AtomicBool::new(false); pub static QUIET: AtomicBool = AtomicBool::new(false);
pub static EMOJIS: AtomicBool = AtomicBool::new(false); pub static EMOJIS: AtomicBool = AtomicBool::new(false);
pub static UNLINK: AtomicBool = AtomicBool::new(false);
pub static FORCE: AtomicBool = AtomicBool::new(false);