diff options
author | Matthias Beyer <mail@beyermatthias.de> | 2021-04-06 17:06:11 +0200 |
---|---|---|
committer | Matthias Beyer <mail@beyermatthias.de> | 2021-04-06 17:06:11 +0200 |
commit | fa655bbe8acae9c7f5d46e977ebea01ac0572327 (patch) | |
tree | ba1617c161214df4e589f931cf205ef383a3e52c /src/cli.rs | |
parent | a70d760dd4d24d2d2963f6e48e3fec027f1e8305 (diff) |
Implement first CLI
Signed-off-by: Matthias Beyer <mail@beyermatthias.de>
Diffstat (limited to 'src/cli.rs')
-rw-r--r-- | src/cli.rs | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 0000000..4df70fa --- /dev/null +++ b/src/cli.rs @@ -0,0 +1,46 @@ +use clap::crate_authors; +use clap::crate_version; +use clap::App; +use clap::Arg; + +pub fn app<'a>() -> App<'a> { + App::new("distrox") + .author(crate_authors!()) + .version(crate_version!()) + .about("Distributed social network") + + .subcommand(App::new("create-profile") + .author(crate_authors!()) + .version(crate_version!()) + .about("Create a new profile") + + .arg(Arg::with_name("content") + .index(1) + .multiple(false) + .takes_value(true) + .value_name("CONTENT") + .help("The text posting as first profile content") + ) + ) + + .subcommand(App::new("post") + .author(crate_authors!()) + .version(crate_version!()) + .about("Post to a profile") + .arg(Arg::with_name("head") + .index(1) + .multiple(false) + .takes_value(true) + .value_name("HEAD") + .help("Post with this HEAD as parent") + ) + + .arg(Arg::with_name("content") + .index(2) + .multiple(false) + .takes_value(true) + .value_name("TEXT") + .help("Post this TEXT as text/text") + ) + ) +} |