summaryrefslogtreecommitdiffstats
path: root/src/cli.rs
blob: 21b27e8e2620db9c0aa3fe1a500294eab23ff206 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
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")
            )
        )

        .subcommand(App::new("get")
            .author(crate_authors!())
            .version(crate_version!())
            .about("Get block")
            .arg(Arg::with_name("head")
                .index(1)
                .multiple(false)
                .takes_value(true)
                .required(true)
                .value_name("HEAD")
                .help("Get HEAD block")
            )
        )
}