monotone

monotone Mtn Source Tree

Root/options_list.hh

1#define OPT(name, string, type, default_, description)\
2 OPTVAR(name, type, name, default_)\
3 OPTION(name, name, has_arg<type >(), string, description)
4
5#define GOPT(name, string, type, default_, description)\
6 OPTVAR(globals, type, name, default_)\
7 OPTION(globals, name, has_arg<type >(), string, description)
8
9OPTSET(globals)
10
11OPTVAR(globals, args_vector, args, )
12OPTION(globals, positionals, true, "--", "")
13#ifdef option_bodies
14{
15 args.push_back(arg_type(arg));
16}
17#endif
18
19OPT(author, "author", utf8, , gettext_noop("override author for commit"))
20#ifdef option_bodies
21{
22 author = utf8(arg);
23}
24#endif
25
26OPT(automate_stdio_size, "automate-stdio-size", size_t, 32768,
27 gettext_noop("block size in bytes for \"automate stdio\" output"))
28#ifdef option_bodies
29{
30 automate_stdio_size = boost::lexical_cast<long>(arg);
31 if (automate_stdio_size <= 0)
32 throw bad_arg_internal(F("cannot be zero or negative").str());
33}
34#endif
35
36OPTSET(bind_opts)
37OPTVAR(bind, utf8, bind_address, )
38OPTVAR(bind, utf8, bind_port, )
39OPTVAR(bind, bool, bind_stdio, false)
40OPTVAR(bind, bool, use_transport_auth, true)
41
42OPTION(bind_opts, bind, true, "bind",
43 gettext_noop("address:port to listen on (default :4691)"))
44#ifdef option_bodies
45{
46 string addr_part, port_part;
47 size_t l_colon = arg.find(':');
48 size_t r_colon = arg.rfind(':');
49
50 // not an ipv6 address, as that would have at least two colons
51 if (l_colon == r_colon)
52 {
53 addr_part = (r_colon == string::npos ? arg : arg.substr(0, r_colon));
54 port_part = (r_colon == string::npos ? "" : arg.substr(r_colon+1, arg.size() - r_colon));
55 }
56 else
57 {
58 // IPv6 addresses have a port specified in the style: [2001:388:0:13::]:80
59 size_t squareb = arg.rfind(']');
60 if ((arg.find('[') == 0) && (squareb != string::npos))
61 {
62 if (squareb < r_colon)
63 port_part = (r_colon == string::npos ? "" : arg.substr(r_colon+1, arg.size() - r_colon));
64 else
65 port_part = "";
66 addr_part = (squareb == string::npos ? arg.substr(1, arg.size()) : arg.substr(1, squareb-1));
67 }
68 else
69 {
70 addr_part = arg;
71 port_part = "";
72 }
73 }
74 bind_stdio = false;
75 bind_address = utf8(addr_part);
76 bind_port = utf8(port_part);
77}
78#endif
79OPTION(bind_opts, no_transport_auth, false, "no-transport-auth",
80 gettext_noop("disable transport authentication"))
81#ifdef option_bodies
82{
83 use_transport_auth = false;
84}
85#endif
86OPTION(bind_opts, bind_stdio, false, "stdio",
87 gettext_noop("serve netsync on stdio"))
88#ifdef option_bodies
89{
90 bind_stdio = true;
91}
92#endif
93
94OPTVAR(branch, branch_name, branchname, )
95OPTION(branch, branch, true, "branch,b",
96 gettext_noop("select branch cert for operation"))
97#ifdef option_bodies
98{
99 branchname = branch_name(arg);
100}
101#endif
102
103OPT(brief, "brief", bool, false,
104 gettext_noop("print a brief version of the normal output"))
105#ifdef option_bodies
106{
107 brief = true;
108}
109#endif
110
111GOPT(conf_dir, "confdir", system_path, get_default_confdir(),
112 gettext_noop("set location of configuration directory"))
113#ifdef option_bodies
114{
115 conf_dir = system_path(arg);
116 if (!key_dir_given)
117 key_dir = (conf_dir / "keys");
118}
119#endif
120
121OPT(date, "date", date_t, ,
122 gettext_noop("override date/time for commit"))
123#ifdef option_bodies
124{
125 try
126 {
127 date = date_t::from_string(arg);
128 }
129 catch (std::exception &e)
130 {
131 throw bad_arg_internal(e.what());
132 }
133}
134#endif
135
136GOPT(dbname, "db,d", system_path, , gettext_noop("set name of database"))
137#ifdef option_bodies
138{
139 dbname = system_path(arg);
140}
141#endif
142
143OPTION(globals, debug, false, "debug",
144 gettext_noop("print debug log to stderr while running"))
145#ifdef option_bodies
146{
147 global_sanity.set_debug();
148}
149#endif
150
151OPT(depth, "depth", long, -1,
152 gettext_noop("limit the number of levels of directories to descend"))
153#ifdef option_bodies
154{
155 depth = boost::lexical_cast<long>(arg);
156 if (depth < 0)
157 throw bad_arg_internal(F("cannot be negative").str());
158}
159#endif
160
161
162OPTSET(diff_options)
163
164OPTVAR(diff_options, std::string, external_diff_args, )
165OPTION(diff_options, external_diff_args, true, "diff-args",
166 gettext_noop("argument to pass external diff hook"))
167#ifdef option_bodies
168{
169 external_diff_args = arg;
170}
171#endif
172
173OPTVAR(diff_options, diff_type, diff_format, unified_diff)
174OPTION(diff_options, diff_context, false, "context",
175 gettext_noop("use context diff format"))
176#ifdef option_bodies
177{
178 diff_format = context_diff;
179}
180#endif
181OPTION(diff_options, diff_external, false, "external",
182 gettext_noop("use external diff hook for generating diffs"))
183#ifdef option_bodies
184{
185 diff_format = external_diff;
186}
187#endif
188OPTION(diff_options, diff_unified, false, "unified",
189 gettext_noop("use unified diff format"))
190#ifdef option_bodies
191{
192 diff_format = unified_diff;
193}
194#endif
195OPTVAR(diff_options, bool, no_show_encloser, false)
196OPTION(diff_options, no_show_encloser, false, "no-show-encloser",
197 gettext_noop("do not show the function containing each block of changes"))
198#ifdef option_bodies
199{
200 no_show_encloser = true;
201}
202#endif
203
204OPT(diffs, "diffs", bool, false, gettext_noop("print diffs along with logs"))
205#ifdef option_bodies
206{
207 diffs = true;
208}
209#endif
210
211OPTVAR(drop_attr, std::set<std::string>, attrs_to_drop, )
212OPTION(drop_attr, drop_attr, true, "drop-attr",
213 gettext_noop("when rosterifying, drop attrs entries with the given key"))
214#ifdef option_bodies
215{
216 attrs_to_drop.insert(arg);
217}
218#endif
219
220OPT(dryrun, "dry-run", bool, false,
221 gettext_noop("don't perform the operation, just show what would have happened"))
222#ifdef option_bodies
223{
224 dryrun = true;
225}
226#endif
227
228OPTION(globals, dump, true, "dump",
229 gettext_noop("file to dump debugging log to, on failure"))
230#ifdef option_bodies
231{
232 global_sanity.filename = system_path(arg).as_external();
233}
234#endif
235
236OPTVAR(exclude, args_vector, exclude_patterns, )
237OPTION(exclude, exclude, true, "exclude",
238 gettext_noop("leave out anything described by its argument"))
239#ifdef option_bodies
240{
241 exclude_patterns.push_back(arg_type(arg));
242}
243#endif
244
245OPT(bookkeep_only, "bookkeep-only", bool, false,
246 gettext_noop("only update monotone's internal bookkeeping, not the filesystem"))
247#ifdef option_bodies
248{
249 bookkeep_only = true;
250}
251#endif
252
253GOPT(ssh_sign, "ssh-sign", std::string, "yes",
254 gettext_noop("sign with ssh-agent, 'yes' to sign with ssh if key found, 'no' to force monotone to sign, 'check' to sign with both and compare"))
255#ifdef option_bodies
256{
257 ssh_sign = arg;
258}
259#endif
260
261OPT(full, "full", bool, false,
262 gettext_noop("print detailed version number"))
263#ifdef option_bodies
264{
265 full = true;
266}
267#endif
268
269GOPT(help, "help,h", bool, false, gettext_noop("display help message"))
270#ifdef option_bodies
271{
272 help = true;
273}
274#endif
275
276OPTVAR(include, args_vector, include_patterns, )
277OPTION(include, include, true, "include",
278 gettext_noop("include anything described by its argument"))
279#ifdef option_bodies
280{
281 include_patterns.push_back(arg_type(arg));
282}
283#endif
284
285OPTVAR(key, rsa_keypair_id, signing_key, )
286OPTION(globals, key, true, "key,k", gettext_noop("set key for signatures"))
287#ifdef option_bodies
288{
289 internalize_rsa_keypair_id(utf8(arg), signing_key);
290}
291#endif
292
293GOPT(key_dir, "keydir", system_path, ,
294 gettext_noop("set location of key store"))
295#ifdef option_bodies
296{
297 key_dir = system_path(arg);
298}
299#endif
300
301OPTVAR(key_to_push, std::vector<rsa_keypair_id>, keys_to_push, )
302OPTION(key_to_push, key_to_push, true, "key-to-push",
303 gettext_noop("push the specified key even if it hasn't signed anything"))
304#ifdef option_bodies
305{
306 rsa_keypair_id keyid;
307 internalize_rsa_keypair_id(utf8(arg), keyid);
308 keys_to_push.push_back(keyid);
309}
310#endif
311
312OPT(last, "last", long, -1,
313 gettext_noop("limit log output to the last number of entries"))
314#ifdef option_bodies
315{
316 last = boost::lexical_cast<long>(arg);
317 if (last <= 0)
318 throw bad_arg_internal(F("cannot be zero or negative").str());
319}
320#endif
321
322OPTION(globals, log, true, "log", gettext_noop("file to write the log to"))
323#ifdef option_bodies
324{
325 ui.redirect_log_to(system_path(arg));
326}
327#endif
328
329OPTSET(messages)
330OPTVAR(messages, std::vector<std::string>, message, )
331OPTVAR(messages, utf8, msgfile, )
332OPTION(messages, message, true, "message,m",
333 gettext_noop("set commit changelog message"))
334#ifdef option_bodies
335{
336 message.push_back(arg);
337}
338#endif
339OPTION(messages, msgfile, true, "message-file",
340 gettext_noop("set filename containing commit changelog message"))
341#ifdef option_bodies
342{
343 msgfile = utf8(arg);
344}
345#endif
346
347OPT(missing, "missing", bool, false,
348 gettext_noop("perform the operations for files missing from workspace"))
349#ifdef option_bodies
350{
351 missing = true;
352}
353#endif
354
355OPT(next, "next", long, -1,
356 gettext_noop("limit log output to the next number of entries"))
357#ifdef option_bodies
358{
359 next = boost::lexical_cast<long>(arg);
360 if (next <= 0)
361 throw bad_arg_internal(F("cannot be zero or negative").str());
362}
363#endif
364
365OPT(no_files, "no-files", bool, false,
366 gettext_noop("exclude files when printing logs"))
367#ifdef option_bodies
368{
369 no_files = true;
370}
371#endif
372
373OPT(no_graph, "no-graph", bool, false,
374 gettext_noop("do not use ASCII graph to display ancestry"))
375#ifdef option_bodies
376{
377 no_graph = true;
378}
379#endif
380
381OPT(no_ignore, "no-respect-ignore", bool, false,
382 gettext_noop("do not ignore any files"))
383#ifdef option_bodies
384{
385 no_ignore = true;
386}
387#endif
388
389OPT(no_merges, "no-merges", bool, false,
390 gettext_noop("exclude merges when printing logs"))
391#ifdef option_bodies
392{
393 no_merges = true;
394}
395#endif
396
397GOPT(norc, "norc", bool, false,
398gettext_noop("do not load ~/.monotone/monotonerc or _MTN/monotonerc lua files"))
399#ifdef option_bodies
400{
401 norc = true;
402}
403#endif
404
405GOPT(nostd, "nostd", bool, false,
406 gettext_noop("do not load standard lua hooks"))
407#ifdef option_bodies
408{
409 nostd = true;
410}
411#endif
412
413OPT(pidfile, "pid-file", system_path, ,
414 gettext_noop("record process id of server"))
415#ifdef option_bodies
416{
417 pidfile = system_path(arg);
418}
419#endif
420
421GOPT(quiet, "quiet", bool, false,
422 gettext_noop("suppress verbose, informational and progress messages"))
423#ifdef option_bodies
424{
425 quiet = true;
426 global_sanity.set_quiet();
427 ui.set_tick_writer(new tick_write_nothing);
428}
429#endif
430
431GOPT(extra_rcfiles, "rcfile", args_vector, ,
432 gettext_noop("load extra rc file"))
433#ifdef option_bodies
434{
435 extra_rcfiles.push_back(arg_type(arg));
436}
437#endif
438
439GOPT(reallyquiet, "reallyquiet", bool, false,
440gettext_noop("suppress warning, verbose, informational and progress messages"))
441#ifdef option_bodies
442{
443 reallyquiet = true;
444 global_sanity.set_reallyquiet();
445 ui.set_tick_writer(new tick_write_nothing);
446}
447#endif
448
449OPT(recursive, "recursive,R", bool, false,
450 gettext_noop("also operate on the contents of any listed directories"))
451#ifdef option_bodies
452{
453 recursive = true;
454}
455#endif
456
457OPTVAR(revision, args_vector, revision_selectors, )
458OPTION(revision, revision, true, "revision,r",
459 gettext_noop("select revision id for operation"))
460#ifdef option_bodies
461{
462 revision_selectors.push_back(arg_type(arg));
463}
464#endif
465
466GOPT(root, "root", std::string, ,
467 gettext_noop("limit search for workspace to specified root"))
468#ifdef option_bodies
469{
470 root = arg;
471}
472#endif
473
474OPT(set_default, "set-default", bool, false,
475 gettext_noop("use the current arguments as the future default"))
476#ifdef option_bodies
477{
478 set_default = true;
479}
480#endif
481
482GOPT(ticker, "ticker", std::string, ,
483 gettext_noop("set ticker style (count|dot|none)"))
484#ifdef option_bodies
485{
486 ticker = arg;
487 if (ticker == "none" || global_sanity.quiet)
488 ui.set_tick_writer(new tick_write_nothing);
489 else if (ticker == "dot")
490 ui.set_tick_writer(new tick_write_dot);
491 else if (ticker == "count")
492 ui.set_tick_writer(new tick_write_count);
493 else
494 throw bad_arg_internal(F("argument must be 'none', 'dot', or 'count'").str());
495}
496#endif
497
498OPT(from, "from", args_vector, , gettext_noop("revision(s) to start logging at"))
499#ifdef option_bodies
500{
501 from.push_back(arg_type(arg));
502}
503#endif
504
505OPT(to, "to", args_vector, , gettext_noop("revision(s) to stop logging at"))
506#ifdef option_bodies
507{
508 to.push_back(arg_type(arg));
509}
510#endif
511
512OPT(unknown, "unknown", bool, false,
513 gettext_noop("perform the operations for unknown files from workspace"))
514#ifdef option_bodies
515{
516 unknown = true;
517}
518
519#endif
520
521OPT(verbose, "verbose", bool, false,
522 gettext_noop("verbose completion output"))
523#ifdef option_bodies
524{
525 verbose = true;
526}
527#endif
528
529GOPT(version, "version", bool, false,
530 gettext_noop("print version number, then exit"))
531#ifdef option_bodies
532{
533 version = true;
534}
535#endif
536
537OPTION(globals, xargs, true, "xargs,@",
538 gettext_noop("insert command line arguments taken from the given file"))
539#ifdef option_bodies
540{
541}
542#endif
543
544
545// Local Variables:
546// mode: C++
547// fill-column: 76
548// c-file-style: "gnu"
549// indent-tabs-mode: nil
550// End:
551// vim: et:sw=2:sts=2:ts=2:cino=>2s,{s,\:s,+s,t0,g0,^-2,e-2,n-2,p2s,(0,=s:
552

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status