blob: 4b52ad6fd67b6677d931f7702eb097045a55d833 (
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
|
use clap::crate_authors;
use clap::crate_version;
use clap::App;
use clap::Arg;
use clap::ArgGroup;
pub fn app<'a>() -> App<'a> {
App::new("distrox")
.author(crate_authors!())
.version(crate_version!())
.about("Distributed social network")
.subcommand(App::new("profile")
.author(crate_authors!())
.version(crate_version!())
.about("Profile actions")
.subcommand(App::new("create")
.author(crate_authors!())
.version(crate_version!())
.about("Create profile")
.arg(Arg::new("name")
.long("name")
.required(true)
.takes_value(true)
.value_name("NAME")
.about("Name of the profile")
)
)
.subcommand(App::new("serve")
.author(crate_authors!())
.version(crate_version!())
.about("Just serve the profile")
.arg(Arg::new("name")
.long("name")
.required(true)
.takes_value(true)
.value_name("NAME")
.about("Name of the profile")
)
.arg(Arg::new("connect")
.long("connect")
.required(false)
.takes_value(true)
.multiple(true)
.value_name("MULTIADDR")
.about("Connect to MULTIADDR as well")
)
.arg(Arg::new("listen")
.long("listen")
.required(false)
.takes_value(true)
.multiple(true)
.value_name("MULTIADDR")
.about("Listen on MULTIADDR, e.g. '/ip4/127.0.0.1/tcp/10000'")
)
)
.subcommand(App::new("cat")
.author(crate_authors!())
.version(crate_version!())
.about("Read complete timeline of profile")
.arg(Arg::new("name")
.long("name")
.required(true)
.takes_value(true)
.value_name("NAME")
.about("Name of the profile")
)
)
.subcommand(App::new("post")
.author(crate_authors!())
.version(crate_version!())
.about("Just serve the profile")
.arg(Arg::new("name")
.long("name")
.required(true)
.takes_value(true)
.value_name("NAME")
.about("Name of the profile to post to")
)
.arg(Arg::new("editor")
.long("editor")
.short('e')
.required(false)
.takes_value(false)
.about("Launch the editor for the text to be posted")
.conflicts_with("text")
)
.arg(Arg::new("text")
.long("text")
.required(true)
.takes_value(true)
.value_name("TEXT")
.about("The text to be posted")
.conflicts_with("editor")
)
.group(ArgGroup::new("text-or-editor")
.args(&["text", "editor"])
.required(true) // one must be present
)
)
)
.subcommand(App::new("gui")
.author(crate_authors!())
.version(crate_version!())
.about("Start the distrox gui")
)
}
|