1 | //----------------------------------------------------------- |
---|
2 | // Copyright Christian Arnault LAL-Orsay CNRS |
---|
3 | // arnault@lal.in2p3.fr |
---|
4 | // Modified by garonne@lal.in2p3.fr |
---|
5 | // See the complete license in cmt_license.txt "http://www.cecill.info". |
---|
6 | //----------------------------------------------------------- |
---|
7 | |
---|
8 | #include "cmt_commands.h" |
---|
9 | #include "cmt_tag.h" |
---|
10 | #include "cmt_symbol.h" |
---|
11 | #include "cmt_project.h" |
---|
12 | #include "cmt_log.h" |
---|
13 | #include "cmt_error.h" |
---|
14 | |
---|
15 | ArgParser::ArgParser (CmtContext& context) : cmt(context), argc(0), argv(0), mode(Csh) |
---|
16 | { |
---|
17 | arguments.clear (); |
---|
18 | |
---|
19 | int i = 0; |
---|
20 | |
---|
21 | parsers.add ("awk", i); |
---|
22 | pv.push_back (&ArgParser::do_awk); i++; |
---|
23 | |
---|
24 | parsers.add ("br", i); |
---|
25 | parsers.add ("bro", i); |
---|
26 | parsers.add ("broa", i); |
---|
27 | parsers.add ("broad", i); |
---|
28 | parsers.add ("broadc", i); |
---|
29 | parsers.add ("broadca", i); |
---|
30 | parsers.add ("broadcas", i); |
---|
31 | parsers.add ("broadcast", i); |
---|
32 | pv.push_back (&ArgParser::do_broadcast); i++; |
---|
33 | |
---|
34 | parsers.add ("bu", i); |
---|
35 | parsers.add ("bui", i); |
---|
36 | parsers.add ("buil", i); |
---|
37 | parsers.add ("build", i); |
---|
38 | pv.push_back (&ArgParser::do_build); i++; |
---|
39 | |
---|
40 | parsers.add ("check", i); |
---|
41 | pv.push_back (&ArgParser::do_check); i++; |
---|
42 | |
---|
43 | parsers.add ("check_f", i); |
---|
44 | parsers.add ("check_fi", i); |
---|
45 | parsers.add ("check_fil", i); |
---|
46 | parsers.add ("check_file", i); |
---|
47 | parsers.add ("check_files", i); |
---|
48 | pv.push_back (&ArgParser::do_check_files); i++; |
---|
49 | |
---|
50 | parsers.add ("co", i); |
---|
51 | parsers.add ("checkout", i); |
---|
52 | pv.push_back (&ArgParser::do_checkout); i++; |
---|
53 | |
---|
54 | parsers.add ("cl", i); |
---|
55 | parsers.add ("cle", i); |
---|
56 | parsers.add ("clea", i); |
---|
57 | parsers.add ("clean", i); |
---|
58 | parsers.add ("cleanu", i); |
---|
59 | parsers.add ("cleanup", i); |
---|
60 | pv.push_back (&ArgParser::do_cleanup); i++; |
---|
61 | |
---|
62 | parsers.add ("con", i); |
---|
63 | parsers.add ("conf", i); |
---|
64 | parsers.add ("confi", i); |
---|
65 | parsers.add ("config", i); |
---|
66 | pv.push_back (&ArgParser::do_config); i++; |
---|
67 | |
---|
68 | parsers.add ("create", i); |
---|
69 | pv.push_back (&ArgParser::do_create); i++; |
---|
70 | |
---|
71 | parsers.add ("create_project", i); |
---|
72 | pv.push_back (&ArgParser::do_create_project); i++; |
---|
73 | |
---|
74 | parsers.add ("cvsb", i); |
---|
75 | parsers.add ("cvsbr", i); |
---|
76 | parsers.add ("cvsbra", i); |
---|
77 | parsers.add ("cvsbran", i); |
---|
78 | parsers.add ("cvsbranc", i); |
---|
79 | parsers.add ("cvsbranch", i); |
---|
80 | parsers.add ("cvsbranche", i); |
---|
81 | parsers.add ("cvsbranches", i); |
---|
82 | pv.push_back (&ArgParser::do_cvsbranches); i++; |
---|
83 | |
---|
84 | parsers.add ("cvssubpa", i); |
---|
85 | parsers.add ("cvssubpac", i); |
---|
86 | parsers.add ("cvssubpack", i); |
---|
87 | parsers.add ("cvssubpacka", i); |
---|
88 | parsers.add ("cvssubpackag", i); |
---|
89 | parsers.add ("cvssubpackage", i); |
---|
90 | parsers.add ("cvssubpackages", i); |
---|
91 | pv.push_back (&ArgParser::do_cvssubpackages); i++; |
---|
92 | |
---|
93 | parsers.add ("cvssubpr", i); |
---|
94 | parsers.add ("cvssubpro", i); |
---|
95 | parsers.add ("cvssubproj", i); |
---|
96 | parsers.add ("cvssubproje", i); |
---|
97 | parsers.add ("cvssubprojec", i); |
---|
98 | parsers.add ("cvssubproject", i); |
---|
99 | parsers.add ("cvssubprojects", i); |
---|
100 | pv.push_back (&ArgParser::do_cvssubprojects); i++; |
---|
101 | |
---|
102 | parsers.add ("cvst", i); |
---|
103 | parsers.add ("cvsta", i); |
---|
104 | parsers.add ("cvstag", i); |
---|
105 | parsers.add ("cvstags", i); |
---|
106 | pv.push_back (&ArgParser::do_cvstags); i++; |
---|
107 | |
---|
108 | parsers.add ("d", i); |
---|
109 | parsers.add ("do", i); |
---|
110 | pv.push_back (&ArgParser::do_do); i++; |
---|
111 | |
---|
112 | parsers.add ("e", i); |
---|
113 | parsers.add ("ex", i); |
---|
114 | parsers.add ("exp", i); |
---|
115 | parsers.add ("expa", i); |
---|
116 | parsers.add ("expan", i); |
---|
117 | parsers.add ("expand", i); |
---|
118 | pv.push_back (&ArgParser::do_expand); i++; |
---|
119 | |
---|
120 | parsers.add ("f", i); |
---|
121 | parsers.add ("fi", i); |
---|
122 | parsers.add ("fil", i); |
---|
123 | parsers.add ("filt", i); |
---|
124 | parsers.add ("filte", i); |
---|
125 | parsers.add ("filter", i); |
---|
126 | pv.push_back (&ArgParser::do_filter); i++; |
---|
127 | |
---|
128 | parsers.add ("h", i); |
---|
129 | parsers.add ("he", i); |
---|
130 | parsers.add ("hel", i); |
---|
131 | parsers.add ("help", i); |
---|
132 | pv.push_back (&ArgParser::do_help); i++; |
---|
133 | |
---|
134 | parsers.add ("l", i); |
---|
135 | parsers.add ("lo", i); |
---|
136 | parsers.add ("loc", i); |
---|
137 | parsers.add ("lock", i); |
---|
138 | pv.push_back (&ArgParser::do_lock); i++; |
---|
139 | |
---|
140 | parsers.add ("rel", i); |
---|
141 | parsers.add ("relo", i); |
---|
142 | parsers.add ("reloc", i); |
---|
143 | parsers.add ("reloca", i); |
---|
144 | parsers.add ("relocat", i); |
---|
145 | parsers.add ("relocate", i); |
---|
146 | pv.push_back (&ArgParser::do_relocate); i++; |
---|
147 | |
---|
148 | parsers.add ("rem", i); |
---|
149 | parsers.add ("remo", i); |
---|
150 | parsers.add ("remov", i); |
---|
151 | parsers.add ("remove", i); |
---|
152 | pv.push_back (&ArgParser::do_remove); i++; |
---|
153 | |
---|
154 | parsers.add ("run", i); |
---|
155 | pv.push_back (&ArgParser::do_run); i++; |
---|
156 | |
---|
157 | parsers.add ("run_sequence", i); |
---|
158 | pv.push_back (&ArgParser::do_run_sequence); i++; |
---|
159 | |
---|
160 | parsers.add ("set", i); |
---|
161 | pv.push_back (&ArgParser::do_set); i++; |
---|
162 | |
---|
163 | parsers.add ("setup", i); |
---|
164 | pv.push_back (&ArgParser::do_setup); i++; |
---|
165 | |
---|
166 | parsers.add ("sh", i); |
---|
167 | parsers.add ("sho", i); |
---|
168 | parsers.add ("show", i); |
---|
169 | pv.push_back (&ArgParser::do_show); i++; |
---|
170 | |
---|
171 | parsers.add ("sy", i); |
---|
172 | parsers.add ("sys", i); |
---|
173 | parsers.add ("syst", i); |
---|
174 | parsers.add ("syste", i); |
---|
175 | parsers.add ("system", i); |
---|
176 | pv.push_back (&ArgParser::do_system); i++; |
---|
177 | |
---|
178 | parsers.add ("u", i); |
---|
179 | parsers.add ("un", i); |
---|
180 | parsers.add ("unl", i); |
---|
181 | parsers.add ("unlo", i); |
---|
182 | parsers.add ("unloc", i); |
---|
183 | parsers.add ("unlock", i); |
---|
184 | pv.push_back (&ArgParser::do_unlock); i++; |
---|
185 | |
---|
186 | parsers.add ("v", i); |
---|
187 | parsers.add ("ve", i); |
---|
188 | parsers.add ("ver", i); |
---|
189 | parsers.add ("vers", i); |
---|
190 | parsers.add ("versi", i); |
---|
191 | parsers.add ("versio", i); |
---|
192 | parsers.add ("version", i); |
---|
193 | parsers.add ("--version", i); |
---|
194 | pv.push_back (&ArgParser::do_version); i++; |
---|
195 | |
---|
196 | parsers.add ("-b", i); |
---|
197 | parsers.add ("-ba", i); |
---|
198 | parsers.add ("-bat", i); |
---|
199 | pv.push_back (&ArgParser::option_bat); i++; |
---|
200 | |
---|
201 | parsers.add ("-c", i); |
---|
202 | parsers.add ("-cs", i); |
---|
203 | parsers.add ("-csh", i); |
---|
204 | pv.push_back (&ArgParser::option_csh); i++; |
---|
205 | |
---|
206 | parsers.add ("-d", i); |
---|
207 | parsers.add ("-di", i); |
---|
208 | parsers.add ("-dis", i); |
---|
209 | parsers.add ("-disa", i); |
---|
210 | parsers.add ("-disab", i); |
---|
211 | parsers.add ("-disabl", i); |
---|
212 | parsers.add ("-disable", i); |
---|
213 | parsers.add ("-disable_", i); |
---|
214 | parsers.add ("-disable_w", i); |
---|
215 | parsers.add ("-disable_wa", i); |
---|
216 | parsers.add ("-disable_war", i); |
---|
217 | parsers.add ("-disable_warn", i); |
---|
218 | parsers.add ("-disable_warni", i); |
---|
219 | parsers.add ("-disable_warnin", i); |
---|
220 | parsers.add ("-disable_warning", i); |
---|
221 | parsers.add ("-disable_warnings", i); |
---|
222 | pv.push_back (&ArgParser::option_disable_warnings); i++; |
---|
223 | //Cmt::get_quiet () |
---|
224 | |
---|
225 | parsers.add ("-e", i); |
---|
226 | pv.push_back (&ArgParser::option_e); i++; |
---|
227 | |
---|
228 | parsers.add ("-f", i); |
---|
229 | pv.push_back (&ArgParser::option_f); i++; |
---|
230 | |
---|
231 | parsers.add ("-h", i); |
---|
232 | parsers.add ("-he", i); |
---|
233 | parsers.add ("-hel", i); |
---|
234 | parsers.add ("-help", i); |
---|
235 | parsers.add ("--h", i); |
---|
236 | parsers.add ("--he", i); |
---|
237 | parsers.add ("--hel", i); |
---|
238 | parsers.add ("--help", i); |
---|
239 | pv.push_back (&ArgParser::option_help); i++; |
---|
240 | |
---|
241 | parsers.add ("-ho", i); |
---|
242 | parsers.add ("-hom", i); |
---|
243 | parsers.add ("-home", i); |
---|
244 | pv.push_back (&ArgParser::option_home); i++; |
---|
245 | |
---|
246 | parsers.add ("-n", i); |
---|
247 | pv.push_back (&ArgParser::option_n); i++; |
---|
248 | |
---|
249 | parsers.add ("-no_c", i); |
---|
250 | parsers.add ("-no_cl", i); |
---|
251 | parsers.add ("-no_cle", i); |
---|
252 | parsers.add ("-no_clea", i); |
---|
253 | parsers.add ("-no_clean", i); |
---|
254 | parsers.add ("-no_cleanu", i); |
---|
255 | parsers.add ("-no_cleanup", i); |
---|
256 | pv.push_back (&ArgParser::option_no_cleanup); i++; |
---|
257 | |
---|
258 | parsers.add ("-pac", i); |
---|
259 | parsers.add ("-pack", i); |
---|
260 | pv.push_back (&ArgParser::option_pack); i++; |
---|
261 | |
---|
262 | parsers.add ("-pat", i); |
---|
263 | parsers.add ("-path", i); |
---|
264 | pv.push_back (&ArgParser::option_path); i++; |
---|
265 | |
---|
266 | parsers.add ("-pr", i); |
---|
267 | parsers.add ("-pri", i); |
---|
268 | parsers.add ("-priv", i); |
---|
269 | parsers.add ("-priva", i); |
---|
270 | parsers.add ("-privat", i); |
---|
271 | parsers.add ("-private", i); |
---|
272 | pv.push_back (&ArgParser::option_private); i++; |
---|
273 | |
---|
274 | parsers.add ("-pu", i); |
---|
275 | parsers.add ("-pub", i); |
---|
276 | parsers.add ("-publ", i); |
---|
277 | parsers.add ("-publi", i); |
---|
278 | parsers.add ("-public", i); |
---|
279 | pv.push_back (&ArgParser::option_public); i++; |
---|
280 | |
---|
281 | parsers.add ("-cmt", i); |
---|
282 | parsers.add ("-req", i); |
---|
283 | parsers.add ("-requ", i); |
---|
284 | parsers.add ("-requi", i); |
---|
285 | parsers.add ("-requir", i); |
---|
286 | parsers.add ("-require", i); |
---|
287 | parsers.add ("-requirem", i); |
---|
288 | parsers.add ("-requireme", i); |
---|
289 | parsers.add ("-requiremen", i); |
---|
290 | parsers.add ("-requirement", i); |
---|
291 | parsers.add ("-requirements", i); |
---|
292 | pv.push_back (&ArgParser::option_requirements); i++; |
---|
293 | |
---|
294 | parsers.add ("-s", i); |
---|
295 | parsers.add ("-sh", i); |
---|
296 | pv.push_back (&ArgParser::option_sh); i++; |
---|
297 | |
---|
298 | parsers.add ("-q", i); |
---|
299 | parsers.add ("-qu", i); |
---|
300 | parsers.add ("-qui", i); |
---|
301 | parsers.add ("-quie", i); |
---|
302 | parsers.add ("-quiet", i); |
---|
303 | pv.push_back (&ArgParser::option_quiet); i++; |
---|
304 | |
---|
305 | parsers.add ("-tag", i); |
---|
306 | pv.push_back (&ArgParser::option_tag); i++; |
---|
307 | |
---|
308 | parsers.add ("-tag_add", i); |
---|
309 | pv.push_back (&ArgParser::option_tag_add); i++; |
---|
310 | |
---|
311 | parsers.add ("-tag_remove", i); |
---|
312 | pv.push_back (&ArgParser::option_tag_remove); i++; |
---|
313 | |
---|
314 | parsers.add ("-u", i); |
---|
315 | parsers.add ("-us", i); |
---|
316 | parsers.add ("-use", i); |
---|
317 | pv.push_back (&ArgParser::option_use); i++; |
---|
318 | |
---|
319 | parsers.add ("-user", i); |
---|
320 | parsers.add ("-user_", i); |
---|
321 | parsers.add ("-user_c", i); |
---|
322 | parsers.add ("-user_co", i); |
---|
323 | parsers.add ("-user_con", i); |
---|
324 | parsers.add ("-user_cont", i); |
---|
325 | parsers.add ("-user_conte", i); |
---|
326 | parsers.add ("-user_contex", i); |
---|
327 | parsers.add ("-user_context", i); |
---|
328 | pv.push_back (&ArgParser::option_user_context); i++; |
---|
329 | |
---|
330 | parsers.add ("-v", i); |
---|
331 | parsers.add ("-ve", i); |
---|
332 | parsers.add ("-ver", i); |
---|
333 | parsers.add ("-vers", i); |
---|
334 | parsers.add ("-versi", i); |
---|
335 | parsers.add ("-versio", i); |
---|
336 | parsers.add ("-version", i); |
---|
337 | pv.push_back (&ArgParser::option_version); i++; |
---|
338 | |
---|
339 | parsers.add ("-warn", i); |
---|
340 | parsers.add ("-warni", i); |
---|
341 | parsers.add ("-warnin", i); |
---|
342 | parsers.add ("-warning", i); |
---|
343 | parsers.add ("-warnings", i); |
---|
344 | pv.push_back (&ArgParser::option_warnings); i++; |
---|
345 | |
---|
346 | parsers.add ("-with_v", i); |
---|
347 | parsers.add ("-with_ve", i); |
---|
348 | parsers.add ("-with_ver", i); |
---|
349 | parsers.add ("-with_vers", i); |
---|
350 | parsers.add ("-with_versi", i); |
---|
351 | parsers.add ("-with_versio", i); |
---|
352 | parsers.add ("-with_version", i); |
---|
353 | parsers.add ("-with_version_", i); |
---|
354 | parsers.add ("-with_version_d", i); |
---|
355 | parsers.add ("-with_version_di", i); |
---|
356 | parsers.add ("-with_version_dir", i); |
---|
357 | parsers.add ("-with_version_dire", i); |
---|
358 | parsers.add ("-with_version_direc", i); |
---|
359 | parsers.add ("-with_version_direct", i); |
---|
360 | parsers.add ("-with_version_directo", i); |
---|
361 | parsers.add ("-with_version_director", i); |
---|
362 | parsers.add ("-with_version_directory", i); |
---|
363 | pv.push_back (&ArgParser::option_with_version_directory); i++; |
---|
364 | |
---|
365 | parsers.add ("-without_v", i); |
---|
366 | parsers.add ("-without_ve", i); |
---|
367 | parsers.add ("-without_ver", i); |
---|
368 | parsers.add ("-without_vers", i); |
---|
369 | parsers.add ("-without_versi", i); |
---|
370 | parsers.add ("-without_versio", i); |
---|
371 | parsers.add ("-without_version", i); |
---|
372 | parsers.add ("-without_version_", i); |
---|
373 | parsers.add ("-without_version_d", i); |
---|
374 | parsers.add ("-without_version_di", i); |
---|
375 | parsers.add ("-without_version_dir", i); |
---|
376 | parsers.add ("-without_version_dire", i); |
---|
377 | parsers.add ("-without_version_direc", i); |
---|
378 | parsers.add ("-without_version_direct", i); |
---|
379 | parsers.add ("-without_version_directo", i); |
---|
380 | parsers.add ("-without_version_director", i); |
---|
381 | parsers.add ("-without_version_directory", i); |
---|
382 | pv.push_back (&ArgParser::option_without_version_directory); i++; |
---|
383 | |
---|
384 | parsers.add ("-xml", i); |
---|
385 | pv.push_back (&ArgParser::option_xml); i++; |
---|
386 | } |
---|
387 | |
---|
388 | void ArgParser::shift () |
---|
389 | { |
---|
390 | if (argc > 0) |
---|
391 | { |
---|
392 | argc--; |
---|
393 | argv++; |
---|
394 | } |
---|
395 | } |
---|
396 | |
---|
397 | void ArgParser::unshift () |
---|
398 | { |
---|
399 | argc++; |
---|
400 | argv--; |
---|
401 | } |
---|
402 | |
---|
403 | void ArgParser::fill_arguments () |
---|
404 | { |
---|
405 | while (argc > 0) |
---|
406 | { |
---|
407 | cmt_string& s = arguments.add (); |
---|
408 | s = argv[0]; |
---|
409 | |
---|
410 | //cerr << "Getting arg[" << s << "] " << endl; |
---|
411 | |
---|
412 | shift (); |
---|
413 | } |
---|
414 | } |
---|
415 | |
---|
416 | cmt_string& ArgParser::fill_one_argument () |
---|
417 | { |
---|
418 | if (argc > 0) |
---|
419 | { |
---|
420 | cmt_string& s = arguments.add (); |
---|
421 | s = argv[0]; |
---|
422 | |
---|
423 | //cerr << "Getting arg[" << s << "] " << endl; |
---|
424 | |
---|
425 | shift (); |
---|
426 | |
---|
427 | return (s); |
---|
428 | } |
---|
429 | else |
---|
430 | { |
---|
431 | static cmt_string empty = ""; |
---|
432 | return (empty); |
---|
433 | } |
---|
434 | } |
---|
435 | |
---|
436 | cmt_string& ArgParser::fill_one_argument_filtered () |
---|
437 | { |
---|
438 | if (argc > 0) |
---|
439 | { |
---|
440 | cmt_string& s = arguments.add (); |
---|
441 | s = argv[0]; |
---|
442 | |
---|
443 | if (s[0] == '-') |
---|
444 | { |
---|
445 | s = ""; |
---|
446 | } |
---|
447 | |
---|
448 | //cerr << "Getting arg[" << s << "] " << endl; |
---|
449 | |
---|
450 | shift (); |
---|
451 | |
---|
452 | return (s); |
---|
453 | } |
---|
454 | else |
---|
455 | { |
---|
456 | static cmt_string empty = ""; |
---|
457 | return (empty); |
---|
458 | } |
---|
459 | } |
---|
460 | |
---|
461 | void ArgParser::parse () |
---|
462 | { |
---|
463 | ArgParser& me = *this; |
---|
464 | |
---|
465 | help_action = action_none; |
---|
466 | arguments.clear (); |
---|
467 | extra_line.erase (0); |
---|
468 | extra_file.erase (0); |
---|
469 | mode = Csh; |
---|
470 | |
---|
471 | /// Skip first argument ("cmt") |
---|
472 | shift (); |
---|
473 | |
---|
474 | cmt.m_action = action_none; |
---|
475 | |
---|
476 | while (argc > 0) |
---|
477 | { |
---|
478 | arg = argv[0]; |
---|
479 | |
---|
480 | shift (); |
---|
481 | |
---|
482 | /// Suppress trailing carriage-return |
---|
483 | int cr = arg.find ('\r'); |
---|
484 | if (cr != cmt_string::npos) arg.erase (cr); |
---|
485 | |
---|
486 | /// Suppress enclosing quotes |
---|
487 | if ((arg[0] == '\"') && (arg[arg.size () - 1] == '\"')) |
---|
488 | { |
---|
489 | arg.erase (0, 1); |
---|
490 | arg.erase (arg.size () - 1, 1); |
---|
491 | } |
---|
492 | |
---|
493 | /// Detect and split arguments of the form a=b |
---|
494 | /// left and right part of this argument |
---|
495 | cmt_string reduced_arg = arg; |
---|
496 | int pos = reduced_arg.find ('='); |
---|
497 | if (pos != cmt_string::npos) |
---|
498 | { |
---|
499 | reduced_arg.erase (pos); |
---|
500 | arg.erase (0, pos+1); |
---|
501 | } |
---|
502 | else |
---|
503 | { |
---|
504 | arg = ""; |
---|
505 | } |
---|
506 | |
---|
507 | // cerr << "argc=" << argc << " reduced_arg=[" << reduced_arg << "] arg=[" << arg << "]" << endl; |
---|
508 | |
---|
509 | if (parsers.has (reduced_arg)) |
---|
510 | { |
---|
511 | // This argument corresponds to a known command |
---|
512 | |
---|
513 | int i = (*parsers.find (reduced_arg)); |
---|
514 | |
---|
515 | parser p = pv[i]; |
---|
516 | (me.*p) (); |
---|
517 | } |
---|
518 | else if (cmt.m_action != action_none) |
---|
519 | { |
---|
520 | // We have unexpected arguments (not handled by the command handler). This may sign |
---|
521 | // an unprotected handler implementation. |
---|
522 | CmtMessage::warning ("unexpected parameter " + reduced_arg); |
---|
523 | // if (!cmt.m_quiet) cerr << "#CMT> warning : unexpected parameter " << reduced_arg << endl; |
---|
524 | } |
---|
525 | else |
---|
526 | { |
---|
527 | // This argument does not correspond to a known command. We expect then an action |
---|
528 | // to be executed with that name |
---|
529 | |
---|
530 | unshift (); |
---|
531 | do_do (); |
---|
532 | |
---|
533 | /* |
---|
534 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad command parameter " << arg << endl; |
---|
535 | help_action = action_none; |
---|
536 | */ |
---|
537 | } |
---|
538 | } |
---|
539 | } |
---|
540 | |
---|
541 | void ArgParser::do_awk () |
---|
542 | { |
---|
543 | fill_arguments (); |
---|
544 | cmt.m_action = action_awk; |
---|
545 | } |
---|
546 | |
---|
547 | void ArgParser::do_broadcast () |
---|
548 | { |
---|
549 | fill_arguments (); |
---|
550 | cmt.m_action = action_broadcast; |
---|
551 | |
---|
552 | if (cmt.m_scope_filtering_mode == default_filtering_mode) |
---|
553 | { |
---|
554 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
555 | } |
---|
556 | } |
---|
557 | |
---|
558 | void ArgParser::do_build () |
---|
559 | { |
---|
560 | if (argc > 0) |
---|
561 | { |
---|
562 | arg = argv[0]; |
---|
563 | |
---|
564 | if (arg == "-nmake") |
---|
565 | { |
---|
566 | cmt.m_build_nmake = true; |
---|
567 | shift (); |
---|
568 | } |
---|
569 | } |
---|
570 | |
---|
571 | if (argc > 0) |
---|
572 | { |
---|
573 | arg = argv[0]; |
---|
574 | |
---|
575 | shift (); |
---|
576 | |
---|
577 | if (arg == "constituent_makefile") |
---|
578 | { |
---|
579 | // if (argc > 0) |
---|
580 | if (argc == 1 || (argc == 2 && cmt_string (argv[0]).substr (0, 5) == "-out=")) |
---|
581 | { |
---|
582 | //fill_one_argument (); |
---|
583 | fill_arguments (); |
---|
584 | cmt.m_action = action_build_constituent_makefile; |
---|
585 | } |
---|
586 | else if (argc > 0) |
---|
587 | { |
---|
588 | CmtMessage::error ("syntax: wrong arguments"); |
---|
589 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : wrong arguments" << endl; |
---|
590 | cmt.m_action = action_build_constituent_makefile; |
---|
591 | help_action = action_help; |
---|
592 | } |
---|
593 | else |
---|
594 | { |
---|
595 | CmtMessage::error ("syntax: constituent name missing"); |
---|
596 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : constituent name missing" << endl; |
---|
597 | cmt.m_action = action_build_constituent_makefile; |
---|
598 | help_action = action_help; |
---|
599 | } |
---|
600 | } |
---|
601 | else if (arg == "constituent_config") |
---|
602 | { |
---|
603 | // if (argc > 0) |
---|
604 | if (argc == 1 || |
---|
605 | argc == 2 && |
---|
606 | (cmt_string (argv[0]).substr (0, 5) == "-out=" || |
---|
607 | cmt_string (argv[1]).substr (0, 5) == "-out=") |
---|
608 | ) |
---|
609 | { |
---|
610 | //fill_one_argument (); |
---|
611 | fill_arguments (); |
---|
612 | cmt.m_action = action_build_constituent_config; |
---|
613 | } |
---|
614 | else if (argc > 0) |
---|
615 | { |
---|
616 | CmtMessage::error ("syntax: wrong arguments"); |
---|
617 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : wrong arguments" << endl; |
---|
618 | cmt.m_action = action_build_constituent_config; |
---|
619 | help_action = action_help; |
---|
620 | } |
---|
621 | else |
---|
622 | { |
---|
623 | CmtMessage::error ("syntax: constituent name missing"); |
---|
624 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : constituent name missing" << endl; |
---|
625 | cmt.m_action = action_build_constituent_config; |
---|
626 | help_action = action_help; |
---|
627 | } |
---|
628 | } |
---|
629 | else if (arg == "constituents_makefile") |
---|
630 | { |
---|
631 | fill_arguments (); |
---|
632 | cmt.m_action = action_build_constituents_makefile; |
---|
633 | } |
---|
634 | else if (arg == "constituents_config") |
---|
635 | { |
---|
636 | fill_arguments (); |
---|
637 | cmt.m_action = action_build_constituents_config; |
---|
638 | } |
---|
639 | else if (arg == "dependencies") |
---|
640 | { |
---|
641 | if (argc > 0) |
---|
642 | { |
---|
643 | fill_arguments (); |
---|
644 | cmt.m_action = action_build_dependencies; |
---|
645 | } |
---|
646 | else |
---|
647 | { |
---|
648 | CmtMessage::error ("syntax: arguments missing"); |
---|
649 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing " << endl; |
---|
650 | help_action = action_help; |
---|
651 | cmt.m_action = action_build_dependencies; |
---|
652 | } |
---|
653 | } |
---|
654 | else if (arg == "library_links") |
---|
655 | { |
---|
656 | cmt.m_action = action_build_library_links; |
---|
657 | } |
---|
658 | else if (arg == "make_setup") |
---|
659 | { |
---|
660 | cmt.m_action = action_build_make_setup; |
---|
661 | } |
---|
662 | else if (arg == "msdev") |
---|
663 | { |
---|
664 | if (argc > 0) |
---|
665 | { |
---|
666 | fill_one_argument_filtered (); |
---|
667 | } |
---|
668 | |
---|
669 | cmt.m_action = action_build_msdev; |
---|
670 | } |
---|
671 | else if (arg == "CMT_pacman") |
---|
672 | { |
---|
673 | cmt.m_action = action_build_CMT_pacman; |
---|
674 | } |
---|
675 | else if (arg == "vsnet") |
---|
676 | { |
---|
677 | if (argc > 0) |
---|
678 | { |
---|
679 | fill_one_argument_filtered (); |
---|
680 | } |
---|
681 | |
---|
682 | cmt.m_action = action_build_vsnet; |
---|
683 | } |
---|
684 | else if (arg == "os9_makefile") |
---|
685 | { |
---|
686 | if (argc > 0) |
---|
687 | { |
---|
688 | fill_one_argument (); |
---|
689 | cmt.m_action = action_build_os9_makefile; |
---|
690 | } |
---|
691 | else |
---|
692 | { |
---|
693 | CmtMessage::error ("syntax: arguments missing"); |
---|
694 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing " << endl; |
---|
695 | help_action = action_help; |
---|
696 | cmt.m_action = action_build_os9_makefile; |
---|
697 | } |
---|
698 | } |
---|
699 | else if (arg == "prototype") |
---|
700 | { |
---|
701 | if (argc > 0) |
---|
702 | { |
---|
703 | fill_one_argument (); |
---|
704 | cmt.m_action = action_build_prototype; |
---|
705 | } |
---|
706 | else |
---|
707 | { |
---|
708 | CmtMessage::error ("syntax: arguments missing"); |
---|
709 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl; |
---|
710 | help_action = action_help; |
---|
711 | cmt.m_action = action_build_prototype; |
---|
712 | } |
---|
713 | } |
---|
714 | else if (arg == "readme") |
---|
715 | { |
---|
716 | cmt.m_action = action_build_readme; |
---|
717 | |
---|
718 | fill_arguments (); |
---|
719 | } |
---|
720 | else if (arg == "tag_makefile") |
---|
721 | { |
---|
722 | cmt.m_action = action_build_tag_makefile; |
---|
723 | } |
---|
724 | else if (arg == "temporary_name") |
---|
725 | { |
---|
726 | cmt.m_action = action_build_temporary_name; |
---|
727 | } |
---|
728 | else if (arg == "triggers") |
---|
729 | { |
---|
730 | if (argc > 0) |
---|
731 | { |
---|
732 | fill_one_argument (); |
---|
733 | cmt.m_action = action_build_triggers; |
---|
734 | } |
---|
735 | else |
---|
736 | { |
---|
737 | CmtMessage::error ("syntax: arguments missing"); |
---|
738 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl; |
---|
739 | help_action = action_help; |
---|
740 | cmt.m_action = action_build_triggers; |
---|
741 | } |
---|
742 | } |
---|
743 | else if (arg == "windefs") |
---|
744 | { |
---|
745 | if (argc > 0) |
---|
746 | { |
---|
747 | // fill_one_argument (); |
---|
748 | fill_arguments (); |
---|
749 | cmt.m_action = action_build_windefs; |
---|
750 | } |
---|
751 | else |
---|
752 | { |
---|
753 | CmtMessage::error ("syntax: arguments missing"); |
---|
754 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl; |
---|
755 | help_action = action_help; |
---|
756 | cmt.m_action = action_build_windefs; |
---|
757 | } |
---|
758 | } |
---|
759 | else |
---|
760 | { |
---|
761 | CmtMessage::error ("syntax: wrong build argument"); |
---|
762 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : wrong build argument" << endl; |
---|
763 | help_action = action_help; |
---|
764 | cmt.m_action = action_build; |
---|
765 | } |
---|
766 | } |
---|
767 | else |
---|
768 | { |
---|
769 | CmtMessage::error ("syntax: don't know what to build"); |
---|
770 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to build" << endl; |
---|
771 | help_action = action_help; |
---|
772 | cmt.m_action = action_build; |
---|
773 | } |
---|
774 | } |
---|
775 | |
---|
776 | void ArgParser::do_check () |
---|
777 | { |
---|
778 | if (argc > 0) |
---|
779 | { |
---|
780 | arg = argv[0]; |
---|
781 | |
---|
782 | shift (); |
---|
783 | |
---|
784 | if (arg == "configuration") |
---|
785 | { |
---|
786 | cmt.m_action = action_check_configuration; |
---|
787 | //cmt.m_warnings = true; |
---|
788 | } |
---|
789 | else if (arg == "files") |
---|
790 | { |
---|
791 | if (argc > 0) |
---|
792 | { |
---|
793 | fill_one_argument (); |
---|
794 | if (argc > 0) |
---|
795 | { |
---|
796 | fill_one_argument (); |
---|
797 | cmt.m_action = action_check_files; |
---|
798 | } |
---|
799 | else |
---|
800 | { |
---|
801 | CmtMessage::error ("syntax: reference file name missing"); |
---|
802 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : reference file name missing" << endl; |
---|
803 | help_action = action_help; |
---|
804 | cmt.m_action = action_check_files; |
---|
805 | } |
---|
806 | } |
---|
807 | else |
---|
808 | { |
---|
809 | CmtMessage::error ("syntax: file name missing"); |
---|
810 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : file name missing" << endl; |
---|
811 | help_action = action_help; |
---|
812 | cmt.m_action = action_check_files; |
---|
813 | } |
---|
814 | } |
---|
815 | else if (arg == "version") |
---|
816 | { |
---|
817 | if (argc > 0) |
---|
818 | { |
---|
819 | fill_one_argument (); |
---|
820 | cmt.m_action = action_check_version; |
---|
821 | } |
---|
822 | else |
---|
823 | { |
---|
824 | CmtMessage::error ("syntax: package name missing"); |
---|
825 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : package name missing" << endl; |
---|
826 | help_action = action_help; |
---|
827 | cmt.m_action = action_check_version; |
---|
828 | } |
---|
829 | } |
---|
830 | else |
---|
831 | { |
---|
832 | CmtMessage::error ("syntax: bad check option"); |
---|
833 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad check option" << endl; |
---|
834 | help_action = action_help; |
---|
835 | cmt.m_action = action_check; |
---|
836 | } |
---|
837 | } |
---|
838 | else |
---|
839 | { |
---|
840 | CmtMessage::error ("syntax: don't know what to check"); |
---|
841 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to check" << endl; |
---|
842 | help_action = action_help; |
---|
843 | cmt.m_action = action_check; |
---|
844 | } |
---|
845 | } |
---|
846 | |
---|
847 | void ArgParser::do_check_files () |
---|
848 | { |
---|
849 | if (argc > 0) |
---|
850 | { |
---|
851 | fill_one_argument (); |
---|
852 | if (argc > 0) |
---|
853 | { |
---|
854 | fill_one_argument (); |
---|
855 | cmt.m_action = action_check_files; |
---|
856 | } |
---|
857 | else |
---|
858 | { |
---|
859 | CmtMessage::error ("syntax: reference file name missing"); |
---|
860 | help_action = action_help; |
---|
861 | cmt.m_action = action_check_files; |
---|
862 | } |
---|
863 | } |
---|
864 | else |
---|
865 | { |
---|
866 | CmtMessage::error ("syntax: file name missing"); |
---|
867 | help_action = action_help; |
---|
868 | cmt.m_action = action_check_files; |
---|
869 | } |
---|
870 | } |
---|
871 | |
---|
872 | void ArgParser::do_checkout () |
---|
873 | { |
---|
874 | if (argc > 0) |
---|
875 | { |
---|
876 | fill_arguments (); |
---|
877 | cmt.m_action = action_checkout; |
---|
878 | } |
---|
879 | else |
---|
880 | { |
---|
881 | CmtError::set (CmtError::syntax_error, "checkout argument(s) missing"); |
---|
882 | // CmtMessage::error ("syntax: checkout arguments missing"); |
---|
883 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : checkout arguments missing" << endl; |
---|
884 | help_action = action_help; |
---|
885 | cmt.m_action = action_checkout; |
---|
886 | } |
---|
887 | } |
---|
888 | |
---|
889 | void ArgParser::do_cleanup () |
---|
890 | { |
---|
891 | cmt.m_action = action_cleanup; |
---|
892 | } |
---|
893 | |
---|
894 | void ArgParser::do_config () |
---|
895 | { |
---|
896 | cmt.m_action = action_config; |
---|
897 | } |
---|
898 | |
---|
899 | void ArgParser::do_create () |
---|
900 | { |
---|
901 | if (argc > 0) |
---|
902 | { |
---|
903 | fill_arguments (); |
---|
904 | cmt.m_action = action_create; |
---|
905 | } |
---|
906 | else |
---|
907 | { |
---|
908 | CmtMessage::error ("syntax: create arguments missing"); |
---|
909 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : create arguments missing" << endl; |
---|
910 | help_action = action_help; |
---|
911 | cmt.m_action = action_create; |
---|
912 | } |
---|
913 | } |
---|
914 | |
---|
915 | void ArgParser::do_create_project () |
---|
916 | { |
---|
917 | if (argc > 0) |
---|
918 | { |
---|
919 | fill_arguments (); |
---|
920 | cmt.m_action = action_create_project; |
---|
921 | } |
---|
922 | else |
---|
923 | { |
---|
924 | CmtMessage::error ("syntax: create_project arguments missing"); |
---|
925 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : create_project arguments missing" << endl; |
---|
926 | help_action = action_help; |
---|
927 | cmt.m_action = action_create_project; |
---|
928 | } |
---|
929 | } |
---|
930 | |
---|
931 | void ArgParser::do_cvsbranches () |
---|
932 | { |
---|
933 | if (argc > 0) |
---|
934 | { |
---|
935 | fill_one_argument (); |
---|
936 | cmt.m_action = action_cvsbranches; |
---|
937 | } |
---|
938 | else |
---|
939 | { |
---|
940 | CmtMessage::error ("syntax: cvsbranches arguments missing"); |
---|
941 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : cvsbranches arguments missing" << endl; |
---|
942 | help_action = action_help; |
---|
943 | cmt.m_action = action_cvsbranches; |
---|
944 | } |
---|
945 | } |
---|
946 | |
---|
947 | void ArgParser::do_cvssubpackages () |
---|
948 | { |
---|
949 | if (argc > 0) |
---|
950 | { |
---|
951 | fill_one_argument (); |
---|
952 | } |
---|
953 | |
---|
954 | cmt.m_action = action_cvssubpackages; |
---|
955 | } |
---|
956 | |
---|
957 | void ArgParser::do_cvssubprojects () |
---|
958 | { |
---|
959 | if (argc > 0) |
---|
960 | { |
---|
961 | fill_one_argument (); |
---|
962 | } |
---|
963 | |
---|
964 | cmt.m_action = action_cvssubprojects; |
---|
965 | } |
---|
966 | |
---|
967 | void ArgParser::do_cvstags () |
---|
968 | { |
---|
969 | if (argc > 0) |
---|
970 | { |
---|
971 | fill_arguments (); |
---|
972 | cmt.m_action = action_cvstags; |
---|
973 | } |
---|
974 | else |
---|
975 | { |
---|
976 | CmtMessage::error ("syntax: package name missing"); |
---|
977 | help_action = action_help; |
---|
978 | cmt.m_action = action_cvstags; |
---|
979 | } |
---|
980 | } |
---|
981 | |
---|
982 | void ArgParser::do_do () |
---|
983 | { |
---|
984 | if (argc > 0) |
---|
985 | { |
---|
986 | fill_arguments (); |
---|
987 | |
---|
988 | { |
---|
989 | cmt_string tag_name = "target_"; |
---|
990 | tag_name += arguments[0]; |
---|
991 | |
---|
992 | Tag* tag; |
---|
993 | tag = Tag::add (tag_name, PriorityUserTag, "action", 0); |
---|
994 | tag->mark (); |
---|
995 | } |
---|
996 | |
---|
997 | cmt.m_action = action_do; |
---|
998 | } |
---|
999 | else |
---|
1000 | { |
---|
1001 | CmtMessage::error ("syntax: action not specified"); |
---|
1002 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : action not specified" << endl; |
---|
1003 | help_action = action_help; |
---|
1004 | cmt.m_action = action_do; |
---|
1005 | } |
---|
1006 | } |
---|
1007 | |
---|
1008 | void ArgParser::do_expand () |
---|
1009 | { |
---|
1010 | if (argc > 0) |
---|
1011 | { |
---|
1012 | arg = argv[0]; |
---|
1013 | |
---|
1014 | shift (); |
---|
1015 | if (arg == "model") |
---|
1016 | { |
---|
1017 | if (argc > 0) |
---|
1018 | { |
---|
1019 | fill_arguments (); |
---|
1020 | cmt.m_action = action_expand_model; |
---|
1021 | } |
---|
1022 | else |
---|
1023 | { |
---|
1024 | CmtMessage::error ("syntax: model not specified"); |
---|
1025 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : model not specified" << endl; |
---|
1026 | help_action = action_help; |
---|
1027 | cmt.m_action = action_expand_model; |
---|
1028 | } |
---|
1029 | } |
---|
1030 | else |
---|
1031 | { |
---|
1032 | CmtMessage::error ("syntax: bad expand option"); |
---|
1033 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad expand option" << endl; |
---|
1034 | help_action = action_help; |
---|
1035 | cmt.m_action = action_expand_model; |
---|
1036 | } |
---|
1037 | } |
---|
1038 | else |
---|
1039 | { |
---|
1040 | CmtMessage::error ("syntax: don't know what to expand"); |
---|
1041 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to expand" << endl; |
---|
1042 | help_action = action_help; |
---|
1043 | cmt.m_action = action_expand_model; |
---|
1044 | } |
---|
1045 | } |
---|
1046 | |
---|
1047 | void ArgParser::do_filter () |
---|
1048 | { |
---|
1049 | if (argc > 0) |
---|
1050 | { |
---|
1051 | fill_arguments (); |
---|
1052 | cmt.m_action = action_filter; |
---|
1053 | } |
---|
1054 | else |
---|
1055 | { |
---|
1056 | CmtMessage::error ("syntax: file to filter not specified"); |
---|
1057 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : file to filter not specified" << endl; |
---|
1058 | help_action = action_help; |
---|
1059 | cmt.m_action = action_filter; |
---|
1060 | } |
---|
1061 | } |
---|
1062 | |
---|
1063 | void ArgParser::do_help () |
---|
1064 | { |
---|
1065 | help_action = action_help; |
---|
1066 | } |
---|
1067 | |
---|
1068 | void ArgParser::do_lock () |
---|
1069 | { |
---|
1070 | if (argc > 0) |
---|
1071 | { |
---|
1072 | cmt.m_current_package = fill_one_argument (); |
---|
1073 | cmt.m_current_version.erase (0); |
---|
1074 | cmt.m_current_path.erase (0); |
---|
1075 | |
---|
1076 | if (argc > 0) |
---|
1077 | { |
---|
1078 | cmt.m_current_version = fill_one_argument (); |
---|
1079 | cmt.m_action = action_lock; |
---|
1080 | |
---|
1081 | if (argc > 0) |
---|
1082 | { |
---|
1083 | cmt.m_current_path = fill_one_argument_filtered (); |
---|
1084 | } |
---|
1085 | |
---|
1086 | cmt.m_current_access = UserMode; |
---|
1087 | (Use::current()).set (cmt.m_current_package, |
---|
1088 | cmt.m_current_version, |
---|
1089 | cmt.m_current_path); |
---|
1090 | |
---|
1091 | } |
---|
1092 | else |
---|
1093 | { |
---|
1094 | CmtMessage::error ("syntax: version missing"); |
---|
1095 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : version missing" << endl; |
---|
1096 | help_action = action_help; |
---|
1097 | cmt.m_action = action_lock; |
---|
1098 | } |
---|
1099 | } |
---|
1100 | else |
---|
1101 | { |
---|
1102 | cmt.m_action = action_lock; |
---|
1103 | } |
---|
1104 | } |
---|
1105 | |
---|
1106 | |
---|
1107 | void ArgParser::do_relocate () |
---|
1108 | { |
---|
1109 | cmt.m_action = action_relocate; |
---|
1110 | } |
---|
1111 | |
---|
1112 | |
---|
1113 | void ArgParser::do_remove () |
---|
1114 | { |
---|
1115 | if (argc > 0) |
---|
1116 | { |
---|
1117 | arg = argv[0]; |
---|
1118 | |
---|
1119 | if (arg == "library_links") |
---|
1120 | { |
---|
1121 | shift (); |
---|
1122 | cmt.m_action = action_remove_library_links; |
---|
1123 | } |
---|
1124 | else |
---|
1125 | { |
---|
1126 | cmt.m_current_package = fill_one_argument (); |
---|
1127 | cmt.m_current_version.erase (0); |
---|
1128 | cmt.m_current_path.erase (0); |
---|
1129 | |
---|
1130 | if (argc > 0) |
---|
1131 | { |
---|
1132 | cmt.m_current_version = fill_one_argument (); |
---|
1133 | |
---|
1134 | if (argc > 0) |
---|
1135 | { |
---|
1136 | cmt.m_current_path = fill_one_argument_filtered (); |
---|
1137 | } |
---|
1138 | |
---|
1139 | cmt.m_action = action_remove; |
---|
1140 | } |
---|
1141 | else |
---|
1142 | { |
---|
1143 | CmtMessage::error ("syntax: version missing"); |
---|
1144 | help_action = action_help; |
---|
1145 | cmt.m_action = action_remove; |
---|
1146 | } |
---|
1147 | } |
---|
1148 | } |
---|
1149 | else |
---|
1150 | { |
---|
1151 | CmtMessage::error ("syntax: don't know what to remove"); |
---|
1152 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to remove" << endl; |
---|
1153 | help_action = action_help; |
---|
1154 | cmt.m_action = action_remove; |
---|
1155 | } |
---|
1156 | } |
---|
1157 | |
---|
1158 | void ArgParser::do_run () |
---|
1159 | { |
---|
1160 | if (argc > 0) |
---|
1161 | { |
---|
1162 | fill_arguments (); |
---|
1163 | cmt.m_action = action_run; |
---|
1164 | } |
---|
1165 | else |
---|
1166 | { |
---|
1167 | CmtMessage::error ("syntax: run arguments missing"); |
---|
1168 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : run arguments missing" << endl; |
---|
1169 | help_action = action_help; |
---|
1170 | cmt.m_action = action_run; |
---|
1171 | } |
---|
1172 | } |
---|
1173 | |
---|
1174 | void ArgParser::do_run_sequence () |
---|
1175 | { |
---|
1176 | if (argc > 0) |
---|
1177 | { |
---|
1178 | fill_one_argument (); |
---|
1179 | cmt.m_action = action_run_sequence; |
---|
1180 | } |
---|
1181 | else |
---|
1182 | { |
---|
1183 | CmtMessage::error ("syntax: run_sequence arguments missing"); |
---|
1184 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : run_sequence arguments missing" << endl; |
---|
1185 | help_action = action_help; |
---|
1186 | cmt.m_action = action_run_sequence; |
---|
1187 | } |
---|
1188 | } |
---|
1189 | |
---|
1190 | void ArgParser::do_set () |
---|
1191 | { |
---|
1192 | if (argc > 0) |
---|
1193 | { |
---|
1194 | arg = argv[0]; |
---|
1195 | |
---|
1196 | shift (); |
---|
1197 | |
---|
1198 | if (arg == "version") |
---|
1199 | { |
---|
1200 | fill_arguments (); |
---|
1201 | cmt.m_action = action_set_version; |
---|
1202 | } |
---|
1203 | else if (arg == "versions") |
---|
1204 | { |
---|
1205 | fill_arguments (); |
---|
1206 | |
---|
1207 | cmt.m_action = action_set_versions; |
---|
1208 | |
---|
1209 | if (cmt.m_scope_filtering_mode == default_filtering_mode) |
---|
1210 | { |
---|
1211 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
1212 | } |
---|
1213 | } |
---|
1214 | else |
---|
1215 | { |
---|
1216 | CmtMessage::error ("syntax: bad set argument"); |
---|
1217 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad set argument" << endl; |
---|
1218 | help_action = action_help; |
---|
1219 | //cmt.m_action = action_set; |
---|
1220 | } |
---|
1221 | } |
---|
1222 | else |
---|
1223 | { |
---|
1224 | CmtMessage::error ("syntax: don't know what to set"); |
---|
1225 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to set" << endl; |
---|
1226 | help_action = action_help; |
---|
1227 | //cmt.m_action = action_set; |
---|
1228 | } |
---|
1229 | } |
---|
1230 | |
---|
1231 | void ArgParser::do_setup () |
---|
1232 | { |
---|
1233 | cmt.m_action = action_setup; |
---|
1234 | //cmt.m_warnings = true; |
---|
1235 | } |
---|
1236 | |
---|
1237 | void ArgParser::do_show () |
---|
1238 | { |
---|
1239 | if (argc > 0) |
---|
1240 | { |
---|
1241 | arg = argv[0]; |
---|
1242 | |
---|
1243 | //cerr << "Running show arg=" << arg << endl; |
---|
1244 | |
---|
1245 | shift (); |
---|
1246 | |
---|
1247 | if (arg == "action") |
---|
1248 | { |
---|
1249 | if (argc > 0) |
---|
1250 | { |
---|
1251 | cmt.m_current_target = fill_one_argument (); |
---|
1252 | cmt.m_action = action_show_action; |
---|
1253 | } |
---|
1254 | else |
---|
1255 | { |
---|
1256 | CmtMessage::error ("syntax: action name missing"); |
---|
1257 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : action name missing" << endl; |
---|
1258 | help_action = action_help; |
---|
1259 | cmt.m_action = action_show_action; |
---|
1260 | } |
---|
1261 | } |
---|
1262 | else if (arg == "action_names") |
---|
1263 | { |
---|
1264 | if (argc > 0) |
---|
1265 | { |
---|
1266 | fill_one_argument (); |
---|
1267 | } |
---|
1268 | |
---|
1269 | cmt.m_action = action_show_action_names; |
---|
1270 | } |
---|
1271 | else if (arg == "action_value") |
---|
1272 | { |
---|
1273 | cmt.m_quiet = true; |
---|
1274 | if (argc > 0) |
---|
1275 | { |
---|
1276 | cmt.m_current_target = fill_one_argument (); |
---|
1277 | cmt.m_action = action_show_action_value; |
---|
1278 | } |
---|
1279 | else |
---|
1280 | { |
---|
1281 | CmtMessage::error ("syntax: action name missing"); |
---|
1282 | help_action = action_help; |
---|
1283 | cmt.m_action = action_show_action_value; |
---|
1284 | } |
---|
1285 | } |
---|
1286 | else if (arg == "actions") |
---|
1287 | { |
---|
1288 | if (argc > 0) |
---|
1289 | { |
---|
1290 | fill_one_argument (); |
---|
1291 | } |
---|
1292 | |
---|
1293 | cmt.m_action = action_show_actions; |
---|
1294 | } |
---|
1295 | else if (arg == "all_tags") |
---|
1296 | { |
---|
1297 | cmt.m_action = action_show_all_tags; |
---|
1298 | } |
---|
1299 | else if (arg == "applied_patterns") |
---|
1300 | { |
---|
1301 | cmt.m_action = action_show_applied_patterns; |
---|
1302 | } |
---|
1303 | else if (arg == "author") |
---|
1304 | { |
---|
1305 | cmt.m_action = action_show_author; |
---|
1306 | } |
---|
1307 | else if (arg == "branches") |
---|
1308 | { |
---|
1309 | cmt.m_action = action_show_branches; |
---|
1310 | } |
---|
1311 | else if (arg == "clients") |
---|
1312 | { |
---|
1313 | if (argc > 0) |
---|
1314 | { |
---|
1315 | cmt.m_current_target = fill_one_argument (); |
---|
1316 | |
---|
1317 | cmt.m_action = action_show_clients; |
---|
1318 | |
---|
1319 | if (argc > 0) |
---|
1320 | { |
---|
1321 | fill_one_argument (); |
---|
1322 | if (argc > 0) |
---|
1323 | { |
---|
1324 | fill_one_argument (); |
---|
1325 | } |
---|
1326 | } |
---|
1327 | } |
---|
1328 | else |
---|
1329 | { |
---|
1330 | CmtMessage::error ("syntax: package name missing"); |
---|
1331 | help_action = action_help; |
---|
1332 | cmt.m_action = action_show_clients; |
---|
1333 | } |
---|
1334 | } |
---|
1335 | else if (arg == "cmtpath_patterns") |
---|
1336 | { |
---|
1337 | cmt.m_action = action_show_cmtpath_patterns; |
---|
1338 | } |
---|
1339 | else if (arg == "constituent") |
---|
1340 | { |
---|
1341 | if (argc > 0) |
---|
1342 | { |
---|
1343 | cmt.m_current_target = fill_one_argument (); |
---|
1344 | cmt.m_action = action_show_constituent; |
---|
1345 | } |
---|
1346 | else |
---|
1347 | { |
---|
1348 | CmtMessage::error ("syntax: constituent name missing"); |
---|
1349 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : constituent name missing" << endl; |
---|
1350 | help_action = action_help; |
---|
1351 | cmt.m_action = action_show_constituent; |
---|
1352 | } |
---|
1353 | } |
---|
1354 | else if (arg == "constituent_names") |
---|
1355 | { |
---|
1356 | cmt.m_action = action_show_constituent_names; |
---|
1357 | } |
---|
1358 | else if (arg == "constituents") |
---|
1359 | { |
---|
1360 | cmt.m_action = action_show_constituents; |
---|
1361 | } |
---|
1362 | else if (arg == "container") |
---|
1363 | { |
---|
1364 | if (argc > 0) |
---|
1365 | { |
---|
1366 | fill_arguments (); |
---|
1367 | } |
---|
1368 | cmt.m_action = action_show_container; |
---|
1369 | } |
---|
1370 | else if (arg == "cycles") |
---|
1371 | { |
---|
1372 | cmt.m_action = action_show_cycles; |
---|
1373 | } |
---|
1374 | else if (arg == "fragment") |
---|
1375 | { |
---|
1376 | if (argc > 0) |
---|
1377 | { |
---|
1378 | cmt.m_current_target = fill_one_argument (); |
---|
1379 | cmt.m_action = action_show_fragment; |
---|
1380 | } |
---|
1381 | else |
---|
1382 | { |
---|
1383 | CmtMessage::error ("syntax: fragment name missing"); |
---|
1384 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : fragment name missing" << endl; |
---|
1385 | help_action = action_help; |
---|
1386 | cmt.m_action = action_show_fragment; |
---|
1387 | } |
---|
1388 | } |
---|
1389 | else if (arg == "fragments") |
---|
1390 | { |
---|
1391 | cmt.m_action = action_show_fragments; |
---|
1392 | } |
---|
1393 | else if (arg == "groups") |
---|
1394 | { |
---|
1395 | cmt.m_action = action_show_groups; |
---|
1396 | } |
---|
1397 | else if (arg == "include_dirs") |
---|
1398 | { |
---|
1399 | cmt.m_action = action_show_include_dirs; |
---|
1400 | } |
---|
1401 | else if (arg == "language") |
---|
1402 | { |
---|
1403 | if (argc > 0) |
---|
1404 | { |
---|
1405 | cmt.m_current_target = fill_one_argument (); |
---|
1406 | cmt.m_action = action_show_language; |
---|
1407 | } |
---|
1408 | else |
---|
1409 | { |
---|
1410 | CmtMessage::error ("syntax: language name missing"); |
---|
1411 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : language name missing" << endl; |
---|
1412 | help_action = action_help; |
---|
1413 | cmt.m_action = action_show_language; |
---|
1414 | } |
---|
1415 | } |
---|
1416 | else if (arg == "languages") |
---|
1417 | { |
---|
1418 | cmt.m_action = action_show_languages; |
---|
1419 | } |
---|
1420 | else if (arg == "macro") |
---|
1421 | { |
---|
1422 | if (argc > 0) |
---|
1423 | { |
---|
1424 | cmt.m_current_target = fill_one_argument (); |
---|
1425 | cmt.m_action = action_show_macro; |
---|
1426 | } |
---|
1427 | else |
---|
1428 | { |
---|
1429 | CmtMessage::error ("syntax: macro name missing"); |
---|
1430 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : macro name missing" << endl; |
---|
1431 | help_action = action_help; |
---|
1432 | cmt.m_action = action_show_macro; |
---|
1433 | } |
---|
1434 | } |
---|
1435 | else if (arg == "macro_names") |
---|
1436 | { |
---|
1437 | if (argc > 0) |
---|
1438 | { |
---|
1439 | fill_one_argument (); |
---|
1440 | } |
---|
1441 | |
---|
1442 | cmt.m_action = action_show_macro_names; |
---|
1443 | } |
---|
1444 | else if (arg == "macro_value") |
---|
1445 | { |
---|
1446 | cmt.m_quiet = true; |
---|
1447 | if (argc > 0) |
---|
1448 | { |
---|
1449 | cmt.m_current_target = fill_one_argument (); |
---|
1450 | cmt.m_action = action_show_macro_value; |
---|
1451 | } |
---|
1452 | else |
---|
1453 | { |
---|
1454 | CmtMessage::error ("syntax: macro name missing"); |
---|
1455 | help_action = action_help; |
---|
1456 | cmt.m_action = action_show_macro_value; |
---|
1457 | } |
---|
1458 | } |
---|
1459 | else if (arg == "macros") |
---|
1460 | { |
---|
1461 | if (argc > 0) |
---|
1462 | { |
---|
1463 | fill_one_argument (); |
---|
1464 | } |
---|
1465 | |
---|
1466 | cmt.m_action = action_show_macros; |
---|
1467 | } |
---|
1468 | else if (arg == "manager") |
---|
1469 | { |
---|
1470 | cmt.m_action = action_show_manager; |
---|
1471 | } |
---|
1472 | else if (arg == "packages") |
---|
1473 | { |
---|
1474 | if (argc > 0) |
---|
1475 | { |
---|
1476 | fill_arguments (); |
---|
1477 | // cmt.m_current_target = fill_one_argument (); |
---|
1478 | } |
---|
1479 | |
---|
1480 | cmt.m_action = action_show_packages; |
---|
1481 | } |
---|
1482 | else if (arg == "path") |
---|
1483 | { |
---|
1484 | if (argc == 0) |
---|
1485 | { |
---|
1486 | cmt.m_action = action_show_path; |
---|
1487 | } |
---|
1488 | else if (argc == 1 && cmt_string (argv[0]) == "-d") |
---|
1489 | { |
---|
1490 | fill_one_argument (); |
---|
1491 | cmt.m_action = action_show_path; |
---|
1492 | } |
---|
1493 | else |
---|
1494 | { |
---|
1495 | cmt.m_action = action_show_path; |
---|
1496 | help_action = action_help; |
---|
1497 | } |
---|
1498 | } |
---|
1499 | else if (arg == "pattern") |
---|
1500 | { |
---|
1501 | if (argc > 0) |
---|
1502 | { |
---|
1503 | cmt.m_current_target = fill_one_argument (); |
---|
1504 | cmt.m_action = action_show_pattern; |
---|
1505 | } |
---|
1506 | else |
---|
1507 | { |
---|
1508 | CmtMessage::error ("syntax: pattern name missing"); |
---|
1509 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : pattern name missing" << endl; |
---|
1510 | help_action = action_help; |
---|
1511 | cmt.m_action = action_show_pattern; |
---|
1512 | } |
---|
1513 | } |
---|
1514 | else if (arg == "pattern_names") |
---|
1515 | { |
---|
1516 | cmt.m_action = action_show_pattern_names; |
---|
1517 | } |
---|
1518 | else if (arg == "patterns") |
---|
1519 | { |
---|
1520 | cmt.m_action = action_show_patterns; |
---|
1521 | } |
---|
1522 | else if (arg == "projects") |
---|
1523 | { |
---|
1524 | cmt.m_action = action_show_projects; |
---|
1525 | } |
---|
1526 | else if (arg == "project_author") |
---|
1527 | { |
---|
1528 | cmt.m_action = action_show_project_author; |
---|
1529 | } |
---|
1530 | |
---|
1531 | else if (arg == "pwd") |
---|
1532 | { |
---|
1533 | cmt.m_action = action_show_pwd; |
---|
1534 | } |
---|
1535 | else if (arg == "setup") |
---|
1536 | { |
---|
1537 | cmt.m_action = action_show_setup; |
---|
1538 | |
---|
1539 | if (cmt.m_scope_filtering_mode == default_filtering_mode) |
---|
1540 | { |
---|
1541 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
1542 | } |
---|
1543 | } |
---|
1544 | else if (arg == "set_names") |
---|
1545 | { |
---|
1546 | if (argc > 0) |
---|
1547 | { |
---|
1548 | fill_one_argument (); |
---|
1549 | } |
---|
1550 | |
---|
1551 | cmt.m_action = action_show_set_names; |
---|
1552 | } |
---|
1553 | else if (arg == "set_value") |
---|
1554 | { |
---|
1555 | cmt.m_quiet = true; |
---|
1556 | if (argc > 0) |
---|
1557 | { |
---|
1558 | cmt.m_current_target = fill_one_argument (); |
---|
1559 | cmt.m_action = action_show_set_value; |
---|
1560 | } |
---|
1561 | else |
---|
1562 | { |
---|
1563 | CmtMessage::error ("syntax: set name missing"); |
---|
1564 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : set name missing" << endl; |
---|
1565 | help_action = action_help; |
---|
1566 | cmt.m_action = action_show_set_value; |
---|
1567 | } |
---|
1568 | } |
---|
1569 | else if (arg == "set") |
---|
1570 | { |
---|
1571 | if (argc > 0) |
---|
1572 | { |
---|
1573 | cmt.m_current_target = fill_one_argument (); |
---|
1574 | cmt.m_action = action_show_set; |
---|
1575 | } |
---|
1576 | else |
---|
1577 | { |
---|
1578 | CmtMessage::error ("syntax: set name missing"); |
---|
1579 | help_action = action_help; |
---|
1580 | cmt.m_action = action_show_set; |
---|
1581 | } |
---|
1582 | } |
---|
1583 | else if (arg == "sets") |
---|
1584 | { |
---|
1585 | if (argc > 0) |
---|
1586 | { |
---|
1587 | fill_one_argument (); |
---|
1588 | } |
---|
1589 | |
---|
1590 | cmt.m_action = action_show_sets; |
---|
1591 | } |
---|
1592 | else if (arg == "strategies") |
---|
1593 | { |
---|
1594 | cmt.m_action = action_show_strategies; |
---|
1595 | } |
---|
1596 | else if (arg == "tags") |
---|
1597 | { |
---|
1598 | cmt.m_action = action_show_tags; |
---|
1599 | } |
---|
1600 | else if (arg == "use_paths") |
---|
1601 | { |
---|
1602 | if (argc > 0) |
---|
1603 | { |
---|
1604 | while (argc > 0) |
---|
1605 | { |
---|
1606 | if (strcmp (argv[0], "-private") == 0) |
---|
1607 | { |
---|
1608 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
1609 | } |
---|
1610 | else if (strcmp (argv[0], "--private") == 0) |
---|
1611 | { |
---|
1612 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
1613 | } |
---|
1614 | else |
---|
1615 | { |
---|
1616 | cmt_string& s = arguments.add (); |
---|
1617 | s = argv[0]; |
---|
1618 | } |
---|
1619 | |
---|
1620 | shift (); |
---|
1621 | } |
---|
1622 | |
---|
1623 | cmt.m_action = action_show_use_paths; |
---|
1624 | } |
---|
1625 | else |
---|
1626 | { |
---|
1627 | CmtMessage::error ("syntax: package name missing"); |
---|
1628 | help_action = action_help; |
---|
1629 | cmt.m_action = action_show_use_paths; |
---|
1630 | } |
---|
1631 | } |
---|
1632 | else if ((arg == "u") || |
---|
1633 | (arg == "us") || |
---|
1634 | (arg == "use") || |
---|
1635 | (arg == "uses")) |
---|
1636 | { |
---|
1637 | cmt.m_action = action_show_uses; |
---|
1638 | |
---|
1639 | if (cmt.m_scope_filtering_mode == default_filtering_mode) |
---|
1640 | { |
---|
1641 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
1642 | } |
---|
1643 | } |
---|
1644 | else if (arg == "version") |
---|
1645 | { |
---|
1646 | cmt.m_action = action_show_version; |
---|
1647 | } |
---|
1648 | else if (arg == "versions") |
---|
1649 | { |
---|
1650 | if (argc > 0) |
---|
1651 | { |
---|
1652 | cmt.m_current_target = fill_one_argument (); |
---|
1653 | cmt.m_action = action_show_versions; |
---|
1654 | } |
---|
1655 | else |
---|
1656 | { |
---|
1657 | CmtMessage::error ("syntax: package name missing"); |
---|
1658 | help_action = action_help; |
---|
1659 | cmt.m_action = action_show_versions; |
---|
1660 | } |
---|
1661 | } |
---|
1662 | else |
---|
1663 | { |
---|
1664 | CmtMessage::error ("syntax: bad show argument"); |
---|
1665 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad show argument" << endl; |
---|
1666 | help_action = action_help; |
---|
1667 | cmt.m_action = action_show; |
---|
1668 | } |
---|
1669 | } |
---|
1670 | else |
---|
1671 | { |
---|
1672 | CmtMessage::error ("syntax: don't know what to show"); |
---|
1673 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to show" << endl; |
---|
1674 | help_action = action_help; |
---|
1675 | cmt.m_action = action_show; |
---|
1676 | } |
---|
1677 | } |
---|
1678 | |
---|
1679 | void ArgParser::do_system () |
---|
1680 | { |
---|
1681 | cmt.m_action = action_system; |
---|
1682 | } |
---|
1683 | |
---|
1684 | void ArgParser::do_unlock () |
---|
1685 | { |
---|
1686 | if (argc > 0) |
---|
1687 | { |
---|
1688 | cmt.m_current_package = fill_one_argument (); |
---|
1689 | cmt.m_current_version.erase (0); |
---|
1690 | cmt.m_current_path.erase (0); |
---|
1691 | |
---|
1692 | if (argc > 0) |
---|
1693 | { |
---|
1694 | cmt.m_current_version = fill_one_argument (); |
---|
1695 | cmt.m_action = action_unlock; |
---|
1696 | |
---|
1697 | if (argc > 0) |
---|
1698 | { |
---|
1699 | cmt.m_current_path = fill_one_argument_filtered (); |
---|
1700 | } |
---|
1701 | |
---|
1702 | cmt.m_current_access = UserMode; |
---|
1703 | (Use::current()).set (cmt.m_current_package, |
---|
1704 | cmt.m_current_version, |
---|
1705 | cmt.m_current_path); |
---|
1706 | |
---|
1707 | } |
---|
1708 | else |
---|
1709 | { |
---|
1710 | CmtMessage::error ("syntax: version missing"); |
---|
1711 | help_action = action_help; |
---|
1712 | cmt.m_action = action_unlock; |
---|
1713 | } |
---|
1714 | } |
---|
1715 | else |
---|
1716 | { |
---|
1717 | cmt.m_action = action_unlock; |
---|
1718 | } |
---|
1719 | } |
---|
1720 | |
---|
1721 | void ArgParser::do_version () |
---|
1722 | { |
---|
1723 | cmt.m_action = action_version; |
---|
1724 | } |
---|
1725 | |
---|
1726 | void ArgParser::option_help () |
---|
1727 | { |
---|
1728 | help_action = action_help; |
---|
1729 | } |
---|
1730 | |
---|
1731 | void ArgParser::option_n () |
---|
1732 | { |
---|
1733 | cmt.m_simulation = true; |
---|
1734 | } |
---|
1735 | |
---|
1736 | |
---|
1737 | void ArgParser::option_disable_warnings () |
---|
1738 | { |
---|
1739 | cmt.m_disable_warnings = true; |
---|
1740 | if (CmtMessage::level () <= Warning) |
---|
1741 | CmtMessage::set_level (Error); |
---|
1742 | } |
---|
1743 | |
---|
1744 | void ArgParser::option_quiet () |
---|
1745 | { |
---|
1746 | cmt.m_quiet = true; |
---|
1747 | if (CmtMessage::level () <= Error) |
---|
1748 | CmtMessage::set_level (Fatal); |
---|
1749 | } |
---|
1750 | |
---|
1751 | |
---|
1752 | void ArgParser::option_warnings () |
---|
1753 | { |
---|
1754 | cmt.m_warnings = true; |
---|
1755 | if (CmtMessage::level () != Warning) |
---|
1756 | CmtMessage::set_level (Warning); |
---|
1757 | } |
---|
1758 | |
---|
1759 | void ArgParser::option_csh () |
---|
1760 | { |
---|
1761 | mode = Csh; |
---|
1762 | } |
---|
1763 | |
---|
1764 | void ArgParser::option_sh () |
---|
1765 | { |
---|
1766 | mode = Sh; |
---|
1767 | } |
---|
1768 | |
---|
1769 | void ArgParser::option_bat () |
---|
1770 | { |
---|
1771 | mode = Bat; |
---|
1772 | } |
---|
1773 | |
---|
1774 | void ArgParser::option_requirements () |
---|
1775 | { |
---|
1776 | mode = Requirements; |
---|
1777 | } |
---|
1778 | |
---|
1779 | void ArgParser::option_xml () |
---|
1780 | { |
---|
1781 | mode = Xml; |
---|
1782 | } |
---|
1783 | |
---|
1784 | void ArgParser::option_use () |
---|
1785 | { |
---|
1786 | if (cmt.m_action != action_create) |
---|
1787 | { |
---|
1788 | CmtSystem::cmt_string_vector words; |
---|
1789 | |
---|
1790 | CmtSystem::split (arg, ":", words); |
---|
1791 | |
---|
1792 | cmt.m_current_access = UserMode; |
---|
1793 | |
---|
1794 | if (words.size () > 0) cmt.m_current_package = words[0]; |
---|
1795 | if (words.size () > 1) cmt.m_current_version = words[1]; |
---|
1796 | if (words.size () > 2) cmt.m_current_path = words[2]; |
---|
1797 | (Use::current()).set (cmt.m_current_package, |
---|
1798 | cmt.m_current_version, |
---|
1799 | cmt.m_current_path); |
---|
1800 | |
---|
1801 | Use& use = Use::current(); |
---|
1802 | if (use.get_package_name () == "cmt_standalone") |
---|
1803 | { |
---|
1804 | if (!CmtSystem::cd (use.path) || !CmtSystem::test_file ("requirements")) |
---|
1805 | { |
---|
1806 | CmtError::set (CmtError::package_not_found, use.get_info ()); |
---|
1807 | return; |
---|
1808 | } |
---|
1809 | use.style = none_style; |
---|
1810 | use.structuring_style = without_version_directory; |
---|
1811 | use.change_path (CmtSystem::pwd ()); |
---|
1812 | } |
---|
1813 | else if (!use.move_to ("", true)) |
---|
1814 | { |
---|
1815 | CmtError::set (CmtError::package_not_found, use.get_info ()); |
---|
1816 | return; |
---|
1817 | } |
---|
1818 | Project::order_all (); |
---|
1819 | Cmt::guess_current_project (); |
---|
1820 | } |
---|
1821 | } |
---|
1822 | |
---|
1823 | void ArgParser::option_pack () |
---|
1824 | { |
---|
1825 | if ((cmt.m_action != action_create) && (cmt.m_current_package != arg)) |
---|
1826 | { |
---|
1827 | //CmtSystem::cd (cmt.m_default_path); |
---|
1828 | |
---|
1829 | cmt.m_current_access = UserMode; |
---|
1830 | |
---|
1831 | cmt.m_current_package = arg; |
---|
1832 | cmt.m_current_version = ""; |
---|
1833 | |
---|
1834 | /* |
---|
1835 | cerr << "ArgParser::option_pack> " |
---|
1836 | << " cp=" << cmt.m_current_package |
---|
1837 | << " cv=" << cmt.m_current_version |
---|
1838 | << " cp=" << cmt.m_current_path << endl; |
---|
1839 | */ |
---|
1840 | |
---|
1841 | (Use::current()).set (cmt.m_current_package, |
---|
1842 | cmt.m_current_version, |
---|
1843 | cmt.m_current_path); |
---|
1844 | } |
---|
1845 | } |
---|
1846 | |
---|
1847 | void ArgParser::option_version () |
---|
1848 | { |
---|
1849 | if ((cmt.m_action != action_create) && (cmt.m_current_version != arg)) |
---|
1850 | { |
---|
1851 | cmt.m_current_access = UserMode; |
---|
1852 | cmt.m_current_version = arg; |
---|
1853 | |
---|
1854 | /* |
---|
1855 | cerr << "ArgParser::option_version> " |
---|
1856 | << " cp=" << cmt.m_current_package |
---|
1857 | << " cv=" << cmt.m_current_version |
---|
1858 | << " cp=" << cmt.m_current_path << endl; |
---|
1859 | */ |
---|
1860 | |
---|
1861 | (Use::current()).set (cmt.m_current_package, |
---|
1862 | cmt.m_current_version, |
---|
1863 | cmt.m_current_path); |
---|
1864 | } |
---|
1865 | } |
---|
1866 | |
---|
1867 | void ArgParser::option_path () |
---|
1868 | { |
---|
1869 | if ((cmt.m_action != action_create) && (cmt.m_current_path != arg)) |
---|
1870 | { |
---|
1871 | cmt.m_current_access = UserMode; |
---|
1872 | cmt.m_current_path = arg; |
---|
1873 | |
---|
1874 | /* |
---|
1875 | cerr << "ArgParser::option_path> " |
---|
1876 | << " cp=" << cmt.m_current_package |
---|
1877 | << " cv=" << cmt.m_current_version |
---|
1878 | << " cp=" << cmt.m_current_path << endl; |
---|
1879 | */ |
---|
1880 | |
---|
1881 | (Use::current()).set (cmt.m_current_package, |
---|
1882 | cmt.m_current_version, |
---|
1883 | cmt.m_current_path); |
---|
1884 | |
---|
1885 | //IProjectFactory& factory = ProjectFactory::instance (); |
---|
1886 | //CmtSystem::add_cmt_path (cmt.m_current_path, "argument", factory); |
---|
1887 | Use& use = Use::current(); |
---|
1888 | if (use.get_package_name () == "cmt_standalone") |
---|
1889 | { |
---|
1890 | if (!CmtSystem::cd (use.path) || !CmtSystem::test_file ("requirements")) |
---|
1891 | { |
---|
1892 | CmtError::set (CmtError::package_not_found, use.get_info ()); |
---|
1893 | return; |
---|
1894 | } |
---|
1895 | use.style = none_style; |
---|
1896 | use.structuring_style = without_version_directory; |
---|
1897 | use.change_path (CmtSystem::pwd ()); |
---|
1898 | } |
---|
1899 | else if (!use.move_to ("", true)) |
---|
1900 | { |
---|
1901 | CmtError::set (CmtError::package_not_found, use.get_info ()); |
---|
1902 | return; |
---|
1903 | } |
---|
1904 | Project::order_all (); |
---|
1905 | Cmt::guess_current_project (); |
---|
1906 | } |
---|
1907 | } |
---|
1908 | |
---|
1909 | void ArgParser::option_f () |
---|
1910 | { |
---|
1911 | extra_file = arg; |
---|
1912 | } |
---|
1913 | |
---|
1914 | void ArgParser::option_e () |
---|
1915 | { |
---|
1916 | CmtMessage::warning ("extra statement = " + arg); |
---|
1917 | // cerr << "#CMT> Warning: extra statement = " << arg << endl; |
---|
1918 | extra_line = arg; |
---|
1919 | } |
---|
1920 | |
---|
1921 | void ArgParser::option_home () |
---|
1922 | { |
---|
1923 | if (CmtSystem::test_directory (arg)) |
---|
1924 | { |
---|
1925 | cmt.m_cmt_home = arg; |
---|
1926 | } |
---|
1927 | } |
---|
1928 | |
---|
1929 | void ArgParser::option_tag () |
---|
1930 | { |
---|
1931 | /* |
---|
1932 | Here we are going to change the complete tag set |
---|
1933 | */ |
---|
1934 | if (arg != "") |
---|
1935 | { |
---|
1936 | Tag* tag; |
---|
1937 | CmtSystem::cmt_string_vector words; |
---|
1938 | |
---|
1939 | // First reset selection of all existing tags |
---|
1940 | //Tag::clear_all (); |
---|
1941 | Tag::unmark_all (); |
---|
1942 | cmt.m_extra_tags = ","; |
---|
1943 | |
---|
1944 | // Then restore CMTSITE |
---|
1945 | Cmt::configure_version_tag (); |
---|
1946 | Cmt::configure_site_tag (0); |
---|
1947 | Cmt::configure_uname_tag (); |
---|
1948 | Cmt::configure_hosttype_tag (); |
---|
1949 | Cmt::configure_config_tag (); |
---|
1950 | Cmt::configure_home (0); |
---|
1951 | Cmt::guess_current_project (); |
---|
1952 | |
---|
1953 | CmtSystem::split (arg, " \t,", words); |
---|
1954 | |
---|
1955 | for (int i = 0; i < words.size (); i++) |
---|
1956 | { |
---|
1957 | const cmt_string& a = words[i]; |
---|
1958 | //if (!cmt.m_quiet) cout << "parse_argument(tag_add)> current_tag=" << a << endl; |
---|
1959 | cmt_string s = ","; |
---|
1960 | s += a; |
---|
1961 | s += ","; |
---|
1962 | |
---|
1963 | if (i == 0) |
---|
1964 | { |
---|
1965 | cmt.m_current_tag = a; |
---|
1966 | |
---|
1967 | if (CmtSystem::testenv ("TAGDEBUG")) |
---|
1968 | cerr << "parse_argument(tag_add)> current_tag=" << cmt.m_current_tag << endl; |
---|
1969 | } |
---|
1970 | |
---|
1971 | if (cmt.m_extra_tags.find (s) == cmt_string::npos) |
---|
1972 | { |
---|
1973 | //if (!cmt.m_quiet) cerr << " a=[" << a << "]" << endl; |
---|
1974 | |
---|
1975 | // Then restore uname if the specified tag is CMTCONFIG |
---|
1976 | if (a == CmtSystem::get_cmt_config ()) |
---|
1977 | { |
---|
1978 | Cmt::configure_uname_tag (); |
---|
1979 | } |
---|
1980 | |
---|
1981 | tag = Tag::add (a, PriorityArgument, "arguments", 0); |
---|
1982 | tag->mark (); |
---|
1983 | cmt.m_extra_tags += a; |
---|
1984 | cmt.m_extra_tags += ","; |
---|
1985 | } |
---|
1986 | } |
---|
1987 | // To be sure that a tag |
---|
1988 | Cmt::guess_current_project (); |
---|
1989 | } |
---|
1990 | } |
---|
1991 | |
---|
1992 | void ArgParser::option_tag_add () |
---|
1993 | { |
---|
1994 | Tag* tag; |
---|
1995 | CmtSystem::cmt_string_vector words; |
---|
1996 | |
---|
1997 | |
---|
1998 | CmtSystem::split (arg, " \t,", words); |
---|
1999 | |
---|
2000 | for (int i = 0; i < words.size (); i++) |
---|
2001 | { |
---|
2002 | const cmt_string& a = words[i]; |
---|
2003 | |
---|
2004 | cmt_string s = ","; |
---|
2005 | s += a; |
---|
2006 | s += ","; |
---|
2007 | |
---|
2008 | if (cmt.m_extra_tags.find (s) == cmt_string::npos) |
---|
2009 | { |
---|
2010 | //if (!cmt.m_quiet) cerr << " a=[" << a << "]" << endl; |
---|
2011 | |
---|
2012 | /// Then restore uname if the specified tag is CMTCONFIG |
---|
2013 | if (a == CmtSystem::get_cmt_config ()) |
---|
2014 | { |
---|
2015 | Cmt::configure_uname_tag (); |
---|
2016 | } |
---|
2017 | |
---|
2018 | tag = Tag::add (a, PriorityUserTag, "arguments", 0); |
---|
2019 | |
---|
2020 | tag->mark (); |
---|
2021 | |
---|
2022 | cmt.m_extra_tags += a; |
---|
2023 | cmt.m_extra_tags += ","; |
---|
2024 | } |
---|
2025 | } |
---|
2026 | } |
---|
2027 | |
---|
2028 | void ArgParser::option_tag_remove () |
---|
2029 | { |
---|
2030 | Tag::TagPtrVector tags = Tag::tags (); |
---|
2031 | int i; |
---|
2032 | Tag* tag; |
---|
2033 | |
---|
2034 | /* |
---|
2035 | for (i = 0; i < tags.size (); i++) |
---|
2036 | { |
---|
2037 | tag = tags[i]; |
---|
2038 | if ((tag != 0) && |
---|
2039 | (tag->selected)) |
---|
2040 | { |
---|
2041 | if (!cmt.m_quiet) cerr << " original tag_list=" << tag->name << tag->priority << endl; |
---|
2042 | } |
---|
2043 | } |
---|
2044 | */ |
---|
2045 | |
---|
2046 | CmtSystem::cmt_string_vector words; |
---|
2047 | |
---|
2048 | //if (!cmt.m_quiet) cerr << "-arg_remove=" << arg << endl; |
---|
2049 | |
---|
2050 | CmtSystem::split (arg, " \t,", words); |
---|
2051 | |
---|
2052 | // |
---|
2053 | // Now erase all entries in the old list that match |
---|
2054 | // the specified tags |
---|
2055 | // |
---|
2056 | |
---|
2057 | for (i = 0; i < words.size (); i++) |
---|
2058 | { |
---|
2059 | const cmt_string& a = words[i]; |
---|
2060 | |
---|
2061 | cmt_string s = ","; |
---|
2062 | s += a; |
---|
2063 | s += ","; |
---|
2064 | |
---|
2065 | int pos; |
---|
2066 | |
---|
2067 | pos = cmt.m_extra_tags.find (s); |
---|
2068 | |
---|
2069 | if (pos != cmt_string::npos) |
---|
2070 | { |
---|
2071 | cmt.m_extra_tags.erase (pos, s.size () - 1); |
---|
2072 | } |
---|
2073 | |
---|
2074 | //if (!cmt.m_quiet) cerr << " tag_list=[" << tag_list << "]" << endl; |
---|
2075 | } |
---|
2076 | |
---|
2077 | // |
---|
2078 | // Now reinject the purged list of tags into the database |
---|
2079 | // exactly as when using -tag=<tag-list> |
---|
2080 | // |
---|
2081 | |
---|
2082 | /// First forget about all existing tags |
---|
2083 | Tag::unmark_all (); |
---|
2084 | |
---|
2085 | /// Then restore CMTSITE |
---|
2086 | Cmt::configure_version_tag (); |
---|
2087 | Cmt::configure_site_tag (0); |
---|
2088 | Cmt::configure_uname_tag (); |
---|
2089 | Cmt::configure_hosttype_tag (); |
---|
2090 | |
---|
2091 | CmtSystem::split (cmt.m_extra_tags, " \t,", words); |
---|
2092 | |
---|
2093 | for (i = 0; i < words.size (); i++) |
---|
2094 | { |
---|
2095 | const cmt_string& a = words[i]; |
---|
2096 | |
---|
2097 | //fprintf (stderr, " a=[%s]\n", a.c_str ()); |
---|
2098 | |
---|
2099 | /// Then restore uname if the specified tag is CMTCONFIG |
---|
2100 | if (a == CmtSystem::get_cmt_config ()) |
---|
2101 | { |
---|
2102 | Cmt::configure_uname_tag (); |
---|
2103 | } |
---|
2104 | |
---|
2105 | if (i == 0) |
---|
2106 | { |
---|
2107 | cmt.m_current_tag = a; |
---|
2108 | |
---|
2109 | //if (!cmt.m_quiet) cerr << "parse_argument(tag_remove)> current_tag=" |
---|
2110 | //<< cmt.m_current_tag << endl; |
---|
2111 | |
---|
2112 | tag = Tag::add (a, PriorityTag, "restore configuration", 0); |
---|
2113 | } |
---|
2114 | else |
---|
2115 | { |
---|
2116 | tag = Tag::add (a, PriorityUserTag, "restore configuration", 0); |
---|
2117 | } |
---|
2118 | |
---|
2119 | tag->mark (); |
---|
2120 | } |
---|
2121 | } |
---|
2122 | |
---|
2123 | void ArgParser::option_user_context () |
---|
2124 | { |
---|
2125 | if (CmtSystem::test_directory (arg)) |
---|
2126 | { |
---|
2127 | cmt.m_cmt_user_context = arg; |
---|
2128 | } |
---|
2129 | } |
---|
2130 | |
---|
2131 | void ArgParser::option_with_version_directory () |
---|
2132 | { |
---|
2133 | cmt.m_current_structuring_style = with_version_directory; |
---|
2134 | |
---|
2135 | StrategyDef* def = StrategyMgr::find_strategy ("VersionDirectory"); |
---|
2136 | if (def != 0) |
---|
2137 | { |
---|
2138 | def->m_default_value = true; |
---|
2139 | def->m_priority_value = false; |
---|
2140 | } |
---|
2141 | } |
---|
2142 | |
---|
2143 | void ArgParser::option_without_version_directory () |
---|
2144 | { |
---|
2145 | cmt.m_current_structuring_style = without_version_directory; |
---|
2146 | |
---|
2147 | StrategyDef* def = StrategyMgr::find_strategy ("VersionDirectory"); |
---|
2148 | if (def != 0) |
---|
2149 | { |
---|
2150 | def->m_default_value = false; |
---|
2151 | def->m_priority_value = true; |
---|
2152 | } |
---|
2153 | } |
---|
2154 | |
---|
2155 | void ArgParser::option_no_cleanup () |
---|
2156 | { |
---|
2157 | //cmt.m_current_setup_strategy |= SetupNoCleanup; |
---|
2158 | } |
---|
2159 | |
---|
2160 | void ArgParser::option_private () |
---|
2161 | { |
---|
2162 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
2163 | } |
---|
2164 | |
---|
2165 | void ArgParser::option_public () |
---|
2166 | { |
---|
2167 | cmt.m_scope_filtering_mode = block_private_uses; |
---|
2168 | } |
---|
2169 | |
---|
2170 | |
---|
2171 | |
---|
2172 | |
---|
2173 | |
---|
2174 | |
---|
2175 | CommandHelp::HelpMap& CommandHelp::get_help () |
---|
2176 | { |
---|
2177 | static CommandHelp& me = instance (); |
---|
2178 | |
---|
2179 | return (me.m_help); |
---|
2180 | } |
---|
2181 | |
---|
2182 | CommandHelp::HelpTexts& CommandHelp::get_help_texts () |
---|
2183 | { |
---|
2184 | static CommandHelp& me = instance (); |
---|
2185 | |
---|
2186 | return (me.m_help_texts); |
---|
2187 | } |
---|
2188 | |
---|
2189 | const cmt_string& CommandHelp::get_help_text (ActionType key) |
---|
2190 | { |
---|
2191 | static const HelpTexts& help = get_help_texts (); |
---|
2192 | |
---|
2193 | const cmt_string& h = help[key]; |
---|
2194 | return (h); |
---|
2195 | } |
---|
2196 | |
---|
2197 | void CommandHelp::show_all () |
---|
2198 | { |
---|
2199 | static HelpTexts& help_texts = get_help_texts (); |
---|
2200 | |
---|
2201 | cerr << "#> cmt command [option...]" << endl; |
---|
2202 | cerr << "# command :" << endl; |
---|
2203 | |
---|
2204 | int i; |
---|
2205 | |
---|
2206 | for (i = 0; ; i++) |
---|
2207 | { |
---|
2208 | const cmt_string& s = help_texts[i]; |
---|
2209 | if (s == "") break; |
---|
2210 | cerr << "# " << s << endl; |
---|
2211 | } |
---|
2212 | |
---|
2213 | cerr << "# global options :" << endl; |
---|
2214 | |
---|
2215 | cerr << "# -disable_warnings : don't print warnings" << endl; |
---|
2216 | cerr << "# -quiet : don't print errors" << endl; |
---|
2217 | cerr << "# -use=<p>:<v>:<path> : set package version path" << endl; |
---|
2218 | cerr << "# -pack=<package> : set package" << endl; |
---|
2219 | cerr << "# -version=<version> : set version" << endl; |
---|
2220 | cerr << "# -path=<path> : set root path" << endl; |
---|
2221 | cerr << "# -f=<requirement-file> : set input file" << endl; |
---|
2222 | cerr << "# -e=<statement> : add a one line statement" << endl; |
---|
2223 | cerr << "# -tag=<tag-list> : select a new tag-set" << endl; |
---|
2224 | cerr << "# -tag_add=<tag-list> : add specific comma-separated tag(s)" << endl; |
---|
2225 | cerr << "# -tag_remove=<tag-list> : remove specific comma-separated tag(s)" << endl; |
---|
2226 | cerr << "# -warnings : display various warnings" << endl; |
---|
2227 | cerr << "# -with_version_directory : reset to default structuring style" << endl; |
---|
2228 | cerr << "# -without_version_directory : switch structuring style" << endl; |
---|
2229 | cerr << "# -cleanup : activate install area cleanup" << endl; |
---|
2230 | cerr << "# -no_cleanup : inhibit install area cleanup" << endl; |
---|
2231 | cerr << "# -xml : output in XML format (cmt setup, cmt show projects, cmt show uses)" << endl; |
---|
2232 | } |
---|
2233 | |
---|
2234 | void CommandHelp::show (ActionType action) |
---|
2235 | { |
---|
2236 | //cerr << "CommandHelp::show> action = " << action << endl; |
---|
2237 | |
---|
2238 | static HelpTexts& help_texts = get_help_texts (); |
---|
2239 | |
---|
2240 | if (action == action_build) |
---|
2241 | { |
---|
2242 | int i; |
---|
2243 | |
---|
2244 | for (i = action_build_constituent_makefile; i <= action_build_windefs; i++) |
---|
2245 | { |
---|
2246 | const cmt_string& s = help_texts[i]; |
---|
2247 | cerr << "# " << s << endl; |
---|
2248 | } |
---|
2249 | } |
---|
2250 | if (action == action_check) |
---|
2251 | { |
---|
2252 | int i; |
---|
2253 | |
---|
2254 | for (i = action_check_configuration; i <= action_check_version; i++) |
---|
2255 | { |
---|
2256 | const cmt_string& s = help_texts[i]; |
---|
2257 | cerr << "# " << s << endl; |
---|
2258 | } |
---|
2259 | } |
---|
2260 | else if (action == action_show) |
---|
2261 | { |
---|
2262 | int i; |
---|
2263 | |
---|
2264 | for (i = (action_show + 1); i <= action_show_versions; i++) |
---|
2265 | { |
---|
2266 | const cmt_string& s = help_texts[i]; |
---|
2267 | cerr << "# " << s << endl; |
---|
2268 | } |
---|
2269 | } |
---|
2270 | else |
---|
2271 | { |
---|
2272 | const cmt_string& s = get_help_text (action); |
---|
2273 | cerr << "#" << s << endl; |
---|
2274 | } |
---|
2275 | } |
---|
2276 | |
---|
2277 | CommandHelp& CommandHelp::instance () |
---|
2278 | { |
---|
2279 | static CommandHelp me; |
---|
2280 | return (me); |
---|
2281 | } |
---|
2282 | |
---|
2283 | CommandHelp::CommandHelp () |
---|
2284 | { |
---|
2285 | static HelpMap& help = m_help; |
---|
2286 | |
---|
2287 | static HelpTexts& help_texts = m_help_texts; |
---|
2288 | |
---|
2289 | help_texts.clear (); |
---|
2290 | |
---|
2291 | help_texts.add () = "none"; |
---|
2292 | help_texts.add () = "awk"; |
---|
2293 | help_texts.add () = "broadcast [-select=list] [-exclude=list] [-local] [-global] [-begin=pattern] [-depth=n] <command> : apply a command to [some of] the used packages"; |
---|
2294 | help_texts.add () = "build <option> : build actions. (Try cmt help build)"; |
---|
2295 | help_texts.add () = "build constituent_makefile <constituent> : generate constituent Makefile fragment"; |
---|
2296 | help_texts.add () = "build constituent_config <constituent> : generate constituent Makefile fragment, also tag specific Makefile, and setup definitions file, if constituent has associated tag (via -target_tag option, or is action)"; |
---|
2297 | help_texts.add () = "build constituents_makefile : generate constituents.make"; |
---|
2298 | help_texts.add () = "build constituents_config : generate constituents.make, tag specific Makefile, and setup definitions file"; |
---|
2299 | help_texts.add () = "build dependencies : generate dependencies"; |
---|
2300 | help_texts.add () = "build library_links : build symbolic links towards all imported libraries"; |
---|
2301 | help_texts.add () = "build make_setup : build a compiled version of setup scripts"; |
---|
2302 | help_texts.add () = "build msdev : generate MSDEV files"; |
---|
2303 | help_texts.add () = "build CMT_pacman : generate PACMAN manifest file for CMT"; |
---|
2304 | help_texts.add () = "build vsnet : generate VS.NET files"; |
---|
2305 | help_texts.add () = "build os9_makefile : generate Makefile for OS9"; |
---|
2306 | help_texts.add () = "build prototype : generate prototype file"; |
---|
2307 | help_texts.add () = "build readme : generate README.html"; |
---|
2308 | help_texts.add () = "build tag_makefile : generate tag specific Makefile"; |
---|
2309 | help_texts.add () = "build temporary_name : generate a name for a temprary file"; |
---|
2310 | help_texts.add () = "build triggers <constituent> : generate library trigger file"; |
---|
2311 | help_texts.add () = "build windefs [-name=NAME] [@commandfile] (objectfile|library)... : generate def file for Windows shared library [NAME]"; |
---|
2312 | help_texts.add () = "check <option> : check actions. (Try cmt help check)"; |
---|
2313 | help_texts.add () = "check configuration : check configuration"; |
---|
2314 | help_texts.add () = "check files <old> <new> : compare two files and overrides <old> by <new> if different"; |
---|
2315 | help_texts.add () = "check version <name> : check if a name follows a version tag syntax "; |
---|
2316 | help_texts.add () = "co | checkout : perform a cvs/svn checkout over a CMT package"; |
---|
2317 | help_texts.add () = "cleanup [-csh|-sh|-bat] : generate a cleanup script"; |
---|
2318 | help_texts.add () = "config : generate setup and cleanup scripts"; |
---|
2319 | help_texts.add () = "create <package> <version> [<path>] : create and configure a new package"; |
---|
2320 | help_texts.add () = "create_project <project> <name> [<path>] : create and configure a new project"; |
---|
2321 | help_texts.add () = "cvsbranches <module> : display the subdirectories for a module"; |
---|
2322 | help_texts.add () = "cvssubpackages <module> : display the subpackages for a module"; |
---|
2323 | help_texts.add () = "cvssubprojects <module> : display the subprojects for a module"; |
---|
2324 | help_texts.add () = "cvstags <module> : display the CVS tags for a module"; |
---|
2325 | help_texts.add () = "do <action> [<param>=<value>] ... : Execute an action"; |
---|
2326 | help_texts.add () = "expand model <model> : "; |
---|
2327 | help_texts.add () = "filter <in> <out> : filter a file against CMT macros and env. variables"; |
---|
2328 | help_texts.add () = "help | -help | --help : display this help"; |
---|
2329 | help_texts.add () = "load"; |
---|
2330 | help_texts.add () = "lock [<p> <v> [<path>]] : lock a package"; |
---|
2331 | help_texts.add () = "relocate : generate only setup scripts"; |
---|
2332 | help_texts.add () = "remove <package> <version> [<path>] : remove a package version"; |
---|
2333 | help_texts.add () = "remove library_links : remove symbolic links towards all imported libraries"; |
---|
2334 | help_texts.add () = "run '<command>' : apply a command"; |
---|
2335 | help_texts.add () = "run_sequence <sequence file> : execute a cmt equence file"; |
---|
2336 | help_texts.add () = "set version <version> : generate a version file in the current package"; |
---|
2337 | help_texts.add () = "set versions : generate version files into packages"; |
---|
2338 | help_texts.add () = "setup [-csh|-sh|-bat|-cmt|-requirements] : generate a setup script (or standalone requirements file from which generate the setup script)"; |
---|
2339 | help_texts.add () = "show <option> : query actions. (Try cmt help show)"; |
---|
2340 | help_texts.add () = "show action <name> : a formatted action definition"; |
---|
2341 | help_texts.add () = "show action_value <name> : a raw action definition"; |
---|
2342 | help_texts.add () = "show action_names : all action names"; |
---|
2343 | help_texts.add () = "show actions : all action definitions"; |
---|
2344 | help_texts.add () = "show all_tags : all defined tags"; |
---|
2345 | help_texts.add () = "show applied_patterns : all patterns actually applied"; |
---|
2346 | help_texts.add () = "show author : package author"; |
---|
2347 | help_texts.add () = "show branches : added branches"; |
---|
2348 | help_texts.add () = "show clients <package> [<version> [<path>]] : clients of <package> [of <version> [in <path>]]"; |
---|
2349 | help_texts.add () = "show cmtpath_patterns : cmtpath_patterns"; |
---|
2350 | help_texts.add () = "show constituent <name>: constituent definition"; |
---|
2351 | help_texts.add () = "show constituent_names : constituent names"; |
---|
2352 | help_texts.add () = "show constituents : constituent definitions"; |
---|
2353 | help_texts.add () = "show container [<path>]... : container package of current project [or <path>s projects]"; |
---|
2354 | help_texts.add () = "show cycles : cycles in the use graph"; |
---|
2355 | help_texts.add () = "show fragment <name> : one fragment definition"; |
---|
2356 | help_texts.add () = "show fragments : fragment definitions"; |
---|
2357 | help_texts.add () = "show groups : group definitions"; |
---|
2358 | help_texts.add () = "show include_dirs : "; |
---|
2359 | help_texts.add () = "show language <name> : language definition"; |
---|
2360 | help_texts.add () = "show languages : language definitions"; |
---|
2361 | help_texts.add () = "show macro <name> : a formatted macro definition"; |
---|
2362 | help_texts.add () = "show macro_value <name> : a raw macro definition"; |
---|
2363 | help_texts.add () = "show macro_names : all macro names"; |
---|
2364 | help_texts.add () = "show macros : all macro definitions"; |
---|
2365 | help_texts.add () = "show manager : package manager"; |
---|
2366 | help_texts.add () = "show packages [<path>]... : packages reachable from the current context [or <path>s]"; |
---|
2367 | help_texts.add () = "show path [-d] : the package search paths list [in detail]"; |
---|
2368 | help_texts.add () = "show pattern <name> : the pattern definition and usages"; |
---|
2369 | help_texts.add () = "show pattern_names : pattern names"; |
---|
2370 | help_texts.add () = "show patterns : the pattern definitions"; |
---|
2371 | help_texts.add () = "show projects : project definitions"; |
---|
2372 | help_texts.add () = "show project author : project author"; |
---|
2373 | help_texts.add () = "show setup : setup definitions"; |
---|
2374 | help_texts.add () = "show pwd : filtered current directory"; |
---|
2375 | help_texts.add () = "show set <name> : a formatted set definition"; |
---|
2376 | help_texts.add () = "show set_names : set names"; |
---|
2377 | help_texts.add () = "show set_value <name> : a raw set definition"; |
---|
2378 | help_texts.add () = "show sets : set definitions"; |
---|
2379 | help_texts.add () = "show strategies : all strategies (build & version)"; |
---|
2380 | help_texts.add () = "show tags : all currently active tags"; |
---|
2381 | help_texts.add () = "show use_paths <package> : all use paths to the used <package>"; |
---|
2382 | help_texts.add () = "show uses : used packages"; |
---|
2383 | help_texts.add () = "show version : version of the current package"; |
---|
2384 | help_texts.add () = "show versions <package> : visible versions of the selected <package>"; |
---|
2385 | help_texts.add () = "system : display the system tag"; |
---|
2386 | help_texts.add () = "unlock [<p> <v> [<path>]] : unlock a package"; |
---|
2387 | help_texts.add () = "version : version of CMT"; |
---|
2388 | help_texts.add () = ""; |
---|
2389 | |
---|
2390 | //"build <key> : build various components :" |
---|
2391 | //"show <key> : display various infos on :" |
---|
2392 | |
---|
2393 | help.add (action_none, help_texts[action_none]); |
---|
2394 | help.add (action_awk, help_texts[action_awk]); |
---|
2395 | help.add (action_broadcast, help_texts[action_broadcast]); |
---|
2396 | help.add (action_build, help_texts[action_build]); |
---|
2397 | help.add (action_build_constituent_makefile, help_texts[action_build_constituent_makefile]); |
---|
2398 | help.add (action_build_constituent_config, help_texts[action_build_constituent_config]); |
---|
2399 | help.add (action_build_constituents_makefile, help_texts[action_build_constituents_makefile]); |
---|
2400 | help.add (action_build_constituents_config, help_texts[action_build_constituents_config]); |
---|
2401 | help.add (action_build_dependencies, help_texts[action_build_dependencies]); |
---|
2402 | help.add (action_build_library_links, help_texts[action_build_library_links]); |
---|
2403 | help.add (action_build_make_setup, help_texts[action_build_make_setup]); |
---|
2404 | help.add (action_build_msdev, help_texts[action_build_msdev]); |
---|
2405 | help.add (action_build_CMT_pacman, help_texts[action_build_CMT_pacman]); |
---|
2406 | help.add (action_build_vsnet, help_texts[action_build_vsnet]); |
---|
2407 | help.add (action_build_os9_makefile, help_texts[action_build_os9_makefile]); |
---|
2408 | help.add (action_build_prototype, help_texts[action_build_prototype]); |
---|
2409 | help.add (action_build_readme, help_texts[action_build_readme]); |
---|
2410 | help.add (action_build_tag_makefile, help_texts[action_build_tag_makefile]); |
---|
2411 | help.add (action_build_temporary_name, help_texts[action_build_temporary_name]); |
---|
2412 | help.add (action_build_triggers, help_texts[action_build_triggers]); |
---|
2413 | help.add (action_build_windefs, help_texts[action_build_windefs]); |
---|
2414 | help.add (action_check_configuration, help_texts[action_check_configuration]); |
---|
2415 | help.add (action_check_files, help_texts[action_check_files]); |
---|
2416 | help.add (action_check_version, help_texts[action_check_version]); |
---|
2417 | help.add (action_checkout, help_texts[action_checkout]); |
---|
2418 | help.add (action_cleanup, help_texts[action_cleanup]); |
---|
2419 | help.add (action_config, help_texts[action_config]); |
---|
2420 | help.add (action_create, help_texts[action_create]); |
---|
2421 | help.add (action_create_project, help_texts[action_create_project]); |
---|
2422 | help.add (action_cvsbranches, help_texts[action_cvsbranches]); |
---|
2423 | help.add (action_cvssubpackages, help_texts[action_cvssubpackages]); |
---|
2424 | help.add (action_cvssubprojects, help_texts[action_cvssubprojects]); |
---|
2425 | help.add (action_cvstags, help_texts[action_cvstags]); |
---|
2426 | help.add (action_do, help_texts[action_do]); |
---|
2427 | help.add (action_expand_model, help_texts[action_expand_model]); |
---|
2428 | help.add (action_filter, help_texts[action_filter]); |
---|
2429 | help.add (action_help, help_texts[action_help]); |
---|
2430 | help.add (action_load, help_texts[action_load]); |
---|
2431 | help.add (action_lock, help_texts[action_lock]); |
---|
2432 | help.add (action_relocate, help_texts[action_relocate]); |
---|
2433 | help.add (action_remove, help_texts[action_remove]); |
---|
2434 | help.add (action_remove_library_links, help_texts[action_remove_library_links]); |
---|
2435 | help.add (action_run, help_texts[action_run]); |
---|
2436 | help.add (action_run_sequence, help_texts[action_run_sequence]); |
---|
2437 | help.add (action_set_version, help_texts[action_set_version]); |
---|
2438 | help.add (action_set_versions, help_texts[action_set_versions]); |
---|
2439 | help.add (action_setup, help_texts[action_setup]); |
---|
2440 | help.add (action_show, help_texts[action_show]); |
---|
2441 | help.add (action_show_action, help_texts[action_show_action]); |
---|
2442 | help.add (action_show_action_value, help_texts[action_show_action_value]); |
---|
2443 | help.add (action_show_action_names, help_texts[action_show_action_names]); |
---|
2444 | help.add (action_show_actions, help_texts[action_show_actions]); |
---|
2445 | help.add (action_show_all_tags, help_texts[action_show_all_tags]); |
---|
2446 | help.add (action_show_applied_patterns, help_texts[action_show_applied_patterns]); |
---|
2447 | help.add (action_show_author, help_texts[action_show_author]); |
---|
2448 | help.add (action_show_branches, help_texts[action_show_branches]); |
---|
2449 | help.add (action_show_clients, help_texts[action_show_clients]); |
---|
2450 | help.add (action_show_cmtpath_patterns, help_texts[action_show_cmtpath_patterns]); |
---|
2451 | help.add (action_show_constituent, help_texts[action_show_constituent]); |
---|
2452 | help.add (action_show_constituent_names, help_texts[action_show_constituent_names]); |
---|
2453 | help.add (action_show_constituents, help_texts[action_show_constituents]); |
---|
2454 | help.add (action_show_container, help_texts[action_show_container]); |
---|
2455 | help.add (action_show_cycles, help_texts[action_show_cycles]); |
---|
2456 | help.add (action_show_fragment, help_texts[action_show_fragment]); |
---|
2457 | help.add (action_show_fragments, help_texts[action_show_fragments]); |
---|
2458 | help.add (action_show_groups, help_texts[action_show_groups]); |
---|
2459 | help.add (action_show_include_dirs, help_texts[action_show_include_dirs]); |
---|
2460 | help.add (action_show_language, help_texts[action_show_language]); |
---|
2461 | help.add (action_show_languages, help_texts[action_show_languages]); |
---|
2462 | help.add (action_show_macro, help_texts[action_show_macro]); |
---|
2463 | help.add (action_show_macro_value, help_texts[action_show_macro_value]); |
---|
2464 | help.add (action_show_macro_names, help_texts[action_show_macro_names]); |
---|
2465 | help.add (action_show_macros, help_texts[action_show_macros]); |
---|
2466 | help.add (action_show_manager, help_texts[action_show_manager]); |
---|
2467 | help.add (action_show_packages, help_texts[action_show_packages]); |
---|
2468 | help.add (action_show_path, help_texts[action_show_path]); |
---|
2469 | help.add (action_show_pattern, help_texts[action_show_pattern]); |
---|
2470 | help.add (action_show_pattern_names, help_texts[action_show_pattern_names]); |
---|
2471 | help.add (action_show_patterns, help_texts[action_show_patterns]); |
---|
2472 | help.add (action_show_projects, help_texts[action_show_projects]); |
---|
2473 | help.add (action_show_project_author, help_texts[action_show_project_author]); |
---|
2474 | help.add (action_show_setup, help_texts[action_show_setup]); |
---|
2475 | help.add (action_show_pwd, help_texts[action_show_pwd]); |
---|
2476 | help.add (action_show_set, help_texts[action_show_set]); |
---|
2477 | help.add (action_show_set_names, help_texts[action_show_set_names]); |
---|
2478 | help.add (action_show_set_value, help_texts[action_show_set_value]); |
---|
2479 | help.add (action_show_sets, help_texts[action_show_sets]); |
---|
2480 | help.add (action_show_strategies, help_texts[action_show_strategies]); |
---|
2481 | help.add (action_show_tags, help_texts[action_show_tags]); |
---|
2482 | help.add (action_show_use_paths, help_texts[action_show_use_paths]); |
---|
2483 | help.add (action_show_uses, help_texts[action_show_uses]); |
---|
2484 | help.add (action_show_version, help_texts[action_show_version]); |
---|
2485 | help.add (action_show_versions, help_texts[action_show_versions]); |
---|
2486 | help.add (action_system, help_texts[action_system]); |
---|
2487 | help.add (action_unlock, help_texts[action_unlock]); |
---|
2488 | help.add (action_version, help_texts[action_version]); |
---|
2489 | } |
---|
2490 | |
---|