argh
argh copied to clipboard
how skip a field like #[serde(skip)]
how skip a field like #[serde(skip)]
If I’m understanding you correctly, you should be able to define an option field with an option type, with something like this:
#[derive(FromArgs, PartialEq, Debug)]
/// Reach new heights.
struct GoUp<S: FromStr>
where
<S as FromStr>::Err: Display,
{
/// an optional nickname for the pilot
#[argh(option)]
pilot_nickname: Option<S>,
}
```
if nothing is passed in for —pilot-nickname then it will be `None`.
Are there plans to add macros similar to those in like serde #[argh(skip)]
#[derive(Debug, Serialize, Deserialize, Clone, FromArgs, Default)]
#[argh(description = "observer_ward")]
pub struct ObserverWardConfig {
#[serde(default)]
#[argh(skip)]
pub targets: Vec<String>,
/// the target (required, unless --stdin used)
#[argh(option, short = 't')]
pub target: Option<String>,
/// read target(s) from STDIN
#[argh(switch)]
#[serde(skip)]
pub stdin: bool,
/// validate the specified yaml file or grep keyword
#[argh(option)]
#[serde(skip)]
pub verify: Option<String>,
/// read the target from the file
#[argh(option, short = 'f')]
#[serde(skip)]
pub file: Option<String>,
/// update web fingerprint
#[argh(switch, short = 'u')]
#[serde(default)]
pub update_fingerprint: bool,
/// export to the csv file or Import form the csv file
#[argh(option, short = 'c')]
#[serde(skip)]
pub csv: Option<String>,
/// export to the json file or Import form the json file
#[argh(option, short = 'j')]
#[serde(skip)]
pub json: Option<String>,
/// proxy to use for requests (ex:[http(s)|socks5(h)]://host:port)
#[argh(option)]
#[serde(default)]
pub proxy: Option<String>,
/// set request timeout.
#[argh(option, default = "default_timeout()")]
#[serde(default = "default_timeout")]
pub timeout: u64,
/// the 'plugins' directory is used when the parameter is the default
#[argh(option)]
#[serde(default)]
pub plugins: Option<String>,
/// update nuclei plugins
#[argh(switch)]
#[serde(default)]
pub update_plugins: bool,
/// an optional nickname for the pilot
#[argh(switch)]
#[serde(skip)]
pub update_self: bool,
/// number of concurrent threads.
#[argh(option, default = "default_thread()")]
#[serde(default = "default_thread")]
pub thread: u32,
/// send results to webhook server (ex:https://host:port/webhook)
#[argh(option)]
#[serde(default)]
pub webhook: Option<String>,
/// using nmap fingerprint identification service (slow)
#[argh(switch)]
#[serde(default)]
pub service: bool,
/// start a web API service (ex:127.0.0.1:8080)
#[argh(option, short = 's')]
#[serde(skip)]
pub api_server: Option<String>,
/// api Bearer authentication
#[argh(option, default = "default_token()")]
#[serde(skip)]
pub token: String,
/// api background service
#[argh(switch)]
#[serde(skip)]
pub daemon: bool,
/// an optional nickname for the pilot
#[argh(switch)]
#[serde(skip)]
pub silent: bool,
/// filter mode,Display only the fingerprint that is not empty
#[argh(switch)]
#[serde(skip)]
pub filter: bool,
}