Giter Site home page Giter Site logo

Comments (2)

erickt avatar erickt commented on June 11, 2024

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`. 

from argh.

cn-kali-team avatar cn-kali-team commented on June 11, 2024

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,
}

from argh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.