libimagwikifrontend/
ui.rs1use clap::{Arg, App, SubCommand};
21
22pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
23 app
24 .arg(Arg::with_name("wikiname")
25 .long("wiki")
26 .short("w")
27 .takes_value(true)
28 .required(false)
29 .multiple(false)
30 .value_name("WIKI")
31 .help("Name of the wiki to use. Defaults to 'default'"))
32
33 .subcommand(SubCommand::with_name("list")
34 .about("List all ids in this wiki")
35 .version("0.1")
36
37 .arg(Arg::with_name("list-full")
38 .long("full")
39 .takes_value(false)
40 .required(false)
41 .multiple(false)
42 .help("Print full filepath")))
43
44 .subcommand(SubCommand::with_name("idof")
45 .about("List id of an entry in this wiki, if it exists")
46 .version("0.1")
47
48 .arg(Arg::with_name("idof-full")
49 .long("full")
50 .takes_value(false)
51 .required(false)
52 .multiple(false)
53 .help("Print full filepath"))
54
55 .arg(Arg::with_name("idof-name")
56 .index(1)
57 .takes_value(true)
58 .required(true)
59 .multiple(false)
60 .value_name("NAME")
61 .help("Add the entry under this name. The name must be unique, namespaces ('foo/bar') are allowed."))
62 )
63
64 .subcommand(SubCommand::with_name("create-wiki")
65 .about("Create wiki")
66 .version("0.1")
67 .arg(Arg::with_name("create-wiki-name")
68 .index(1)
69 .takes_value(true)
70 .required(true)
71 .multiple(false)
72 .value_name("NAME")
73 .help("Name of the wiki"))
74
75 .arg(Arg::with_name("create-wiki-noedit")
76 .long("no-edit")
77 .short("E")
78 .takes_value(false)
79 .required(false)
80 .multiple(false)
81 .help("Do not call the editor on the newly created entry.")
82 .conflicts_with("create-wiki-editheader"))
83
84 .arg(Arg::with_name("create-wiki-editheader")
85 .long("header")
86 .takes_value(false)
87 .required(false)
88 .multiple(false)
89 .help("Do edit header when editing main page entry.")
90 .conflicts_with("create-wiki-noedit"))
91
92 .arg(Arg::with_name("create-wiki-printid")
93 .long("print-id")
94 .short("I")
95 .takes_value(false)
96 .required(false)
97 .multiple(false)
98 .help("Print the store id after creating"))
99 )
100
101 .subcommand(SubCommand::with_name("create")
102 .about("Add wiki entry")
103 .version("0.1")
104
105 .arg(Arg::with_name("create-name")
106 .index(1)
107 .takes_value(true)
108 .required(true)
109 .multiple(false)
110 .help("Name of the page."))
111
112 .arg(Arg::with_name("create-noedit")
113 .long("no-edit")
114 .short("E")
115 .takes_value(false)
116 .required(false)
117 .multiple(false)
118 .help("Do not call the editor on the newly created entry.")
119 .conflicts_with("create-editheader"))
120
121 .arg(Arg::with_name("create-editheader")
122 .long("header")
123 .takes_value(false)
124 .required(false)
125 .multiple(false)
126 .help("Do edit header when editing entry.")
127 .conflicts_with("create-noedit"))
128
129 .arg(Arg::with_name("create-printid")
130 .long("print-id")
131 .short("I")
132 .takes_value(false)
133 .required(false)
134 .multiple(false)
135 .help("Print the store id after creating"))
136 )
137
138 .subcommand(SubCommand::with_name("show")
139 .about("Show wiki entry/entries")
140 .version("0.1")
141
142 .arg(Arg::with_name("show-name")
143 .index(1)
144 .takes_value(true)
145 .required(true)
146 .multiple(true)
147 .help("Name of the entry/entries to show (if not passed, all are shown)."))
148 )
149
150
151 .subcommand(SubCommand::with_name("delete")
152 .about("Delete wiki entry")
153 .version("0.1")
154 .arg(Arg::with_name("delete-name")
155 .index(1)
156 .takes_value(true)
157 .required(true)
158 .multiple(false)
159 .value_name("NAME")
160 .help("Delete the entry under this name. The name must be unique, namespaces ('foo/bar') are allowed."))
161
162 .arg(Arg::with_name("delete-no-remove-linkings")
163 .long("no-remove-links")
164 .takes_value(false)
165 .required(false)
166 .multiple(false)
167 .help("Do not remote links. WARNING: This leaves the store in an inconsistent state."))
168 )
169
170}