start working on a cli app #7

Merged
schrottkatze merged 12 commits from :app into main 2024-01-20 19:09:52 +00:00
Showing only changes of commit 746c81ab60 - Show all commits

View file

@ -1,6 +1,6 @@
use std::path::PathBuf;
use clap::Parser;
use clap::{builder::BoolishValueParser, ArgAction, Parser};
#[derive(Parser)]
pub(crate) struct Args {
@ -10,6 +10,6 @@ pub(crate) struct Args {
/// Turn off the startup message.
schrottkatze marked this conversation as resolved Outdated
Might want a [`clap::builder::BoolishValueParser`](https://docs.rs/clap/latest/clap/builder/struct.BoolishValueParser.html) here.

How do I use that with claps derive api?

How do I use that with claps derive api?

Through

-    #[arg(long, env = "NO_STARTUP_MESSAGE", default_value = "false")] 
+    #[arg(long, env = "NO_STARTUP_MESSAGE", action = ArgAction::SetTrue, value_parser = BoolishValueParser::new())]
Through ```diff - #[arg(long, env = "NO_STARTUP_MESSAGE", default_value = "false")] + #[arg(long, env = "NO_STARTUP_MESSAGE", action = ArgAction::SetTrue, value_parser = BoolishValueParser::new())] ```
///
/// The startup message is not constant and depends on the time.
#[arg(long, env = "NO_STARTUP_MESSAGE", default_value = "false")]
#[arg(long, env = "NO_STARTUP_MESSAGE", action = ArgAction::SetTrue, value_parser = BoolishValueParser::new())]
pub no_startup_message: bool,
}