source: CMT/HEAD/source/cmt_commands.cxx @ 652

Last change on this file since 652 was 652, checked in by rybkin, 11 years ago

See C.L. 511

  • Property svn:eol-style set to native
File size: 71.6 KB
Line 
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
15ArgParser::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 ("-with_c", i);
340  parsers.add ("-with_cm", i);
341  parsers.add ("-with_cmt", i);
342  pv.push_back (&ArgParser::option_with_cmt); i++;
343
344  parsers.add ("-without_c", i);
345  parsers.add ("-without_cm", i);
346  parsers.add ("-without_cmt", i);
347  pv.push_back (&ArgParser::option_without_cmt); i++;
348
349  parsers.add ("-warn", i);
350  parsers.add ("-warni", i);
351  parsers.add ("-warnin", i);
352  parsers.add ("-warning", i);
353  parsers.add ("-warnings", i);
354  pv.push_back (&ArgParser::option_warnings); i++;
355
356  parsers.add ("-with_v", i);
357  parsers.add ("-with_ve", i);
358  parsers.add ("-with_ver", i);
359  parsers.add ("-with_vers", i);
360  parsers.add ("-with_versi", i);
361  parsers.add ("-with_versio", i);
362  parsers.add ("-with_version", i);
363  parsers.add ("-with_version_", i);
364  parsers.add ("-with_version_d", i);
365  parsers.add ("-with_version_di", i);
366  parsers.add ("-with_version_dir", i);
367  parsers.add ("-with_version_dire", i);
368  parsers.add ("-with_version_direc", i);
369  parsers.add ("-with_version_direct", i);
370  parsers.add ("-with_version_directo", i);
371  parsers.add ("-with_version_director", i);
372  parsers.add ("-with_version_directory", i);
373  pv.push_back (&ArgParser::option_with_version_directory); i++;
374
375  parsers.add ("-without_v", i);
376  parsers.add ("-without_ve", i);
377  parsers.add ("-without_ver", i);
378  parsers.add ("-without_vers", i);
379  parsers.add ("-without_versi", i);
380  parsers.add ("-without_versio", i);
381  parsers.add ("-without_version", i);
382  parsers.add ("-without_version_", i);
383  parsers.add ("-without_version_d", i);
384  parsers.add ("-without_version_di", i);
385  parsers.add ("-without_version_dir", i);
386  parsers.add ("-without_version_dire", i);
387  parsers.add ("-without_version_direc", i);
388  parsers.add ("-without_version_direct", i);
389  parsers.add ("-without_version_directo", i);
390  parsers.add ("-without_version_director", i);
391  parsers.add ("-without_version_directory", i);
392  pv.push_back (&ArgParser::option_without_version_directory); i++;
393
394  parsers.add ("-xml", i);
395  pv.push_back (&ArgParser::option_xml); i++;
396}
397
398void ArgParser::shift ()
399{
400  if (argc > 0)
401    {
402      argc--;
403      argv++;
404    }
405}
406
407void ArgParser::unshift ()
408{
409  argc++;
410  argv--;
411}
412
413void ArgParser::fill_arguments ()
414{
415  while (argc > 0)
416    {
417      cmt_string& s = arguments.add ();
418      s = argv[0];
419
420      //cerr << "Getting arg[" << s << "] " << endl;
421
422      shift ();
423    } 
424}
425
426cmt_string& ArgParser::fill_one_argument ()
427{
428  if (argc > 0)
429    {
430      cmt_string& s = arguments.add ();
431      s = argv[0];
432
433      //cerr << "Getting arg[" << s << "] " << endl;
434
435      shift ();
436
437      return (s);
438    }
439  else
440    {
441      static cmt_string empty = "";
442      return (empty);
443    }
444}
445
446cmt_string& ArgParser::fill_one_argument_filtered ()
447{
448  if (argc > 0)
449    {
450      cmt_string& s = arguments.add ();
451      s = argv[0];
452
453      if (s[0] == '-')
454        {
455          s = "";
456        }
457
458      //cerr << "Getting arg[" << s << "] " << endl;
459
460      shift ();
461
462      return (s);
463    }
464  else
465    {
466      static cmt_string empty = "";
467      return (empty);
468    }
469}
470
471void ArgParser::parse ()
472{
473  ArgParser& me = *this;
474
475  help_action = action_none;
476  arguments.clear ();
477  extra_line.erase (0);
478  extra_file.erase (0);
479  mode = Csh;
480
481  /// Skip first argument ("cmt")
482  shift ();
483
484  cmt.m_action = action_none;
485
486  while (argc > 0)
487    {
488      arg = argv[0];
489
490      shift ();
491
492      /// Suppress trailing carriage-return
493      int cr = arg.find ('\r');
494      if (cr != cmt_string::npos) arg.erase (cr);
495
496      /// Suppress enclosing quotes
497      if ((arg[0] == '\"') && (arg[arg.size () - 1] == '\"'))
498        {
499          arg.erase (0, 1);
500          arg.erase (arg.size () - 1, 1);
501        }
502
503      /// Detect and split arguments of the form a=b
504      /// left and right part of this argument
505      cmt_string reduced_arg = arg;
506      int pos = reduced_arg.find ('=');
507      if (pos != cmt_string::npos)
508        {
509          reduced_arg.erase (pos);
510          arg.erase (0, pos+1);
511        }
512      else
513        {
514          arg = "";
515        }
516
517      // cerr << "argc=" << argc << " reduced_arg=[" << reduced_arg << "] arg=[" << arg << "]" << endl;
518
519      if (parsers.has (reduced_arg))
520        {
521          // This argument corresponds to a known command
522
523          int i = (*parsers.find (reduced_arg));
524
525          parser p = pv[i];
526          (me.*p) ();
527        }
528      else if (cmt.m_action != action_none)
529        {
530          // We have unexpected arguments (not handled by the command handler). This may sign
531          // an unprotected handler implementation.
532          if (help_action != action_help)
533            CmtMessage::warning ("unexpected parameter " + reduced_arg);
534          //      if (!cmt.m_quiet) cerr << "#CMT> warning : unexpected parameter " << reduced_arg << endl;
535        }
536      else
537        {
538          // This argument does not correspond to a known command. We expect then an action
539          // to be executed with that name
540
541          unshift ();
542          do_do ();
543
544          /*
545              if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad command parameter " << arg << endl;
546              help_action = action_none;
547          */
548        }
549    }
550}
551
552void ArgParser::do_awk ()
553{
554  fill_arguments ();
555  cmt.m_action = action_awk;
556}
557
558void ArgParser::do_broadcast ()
559{
560  fill_arguments ();
561  cmt.m_action = action_broadcast;
562 
563  if (cmt.m_scope_filtering_mode == default_filtering_mode)
564    {
565      cmt.m_scope_filtering_mode = reach_private_uses;
566    }
567}
568
569void ArgParser::do_build ()
570{
571  if (argc > 0)
572    {
573      arg = argv[0];
574
575      if (arg == "-nmake")
576        {
577          cmt.m_build_nmake = true;
578          shift ();
579        }
580    }
581
582  if (argc > 0)
583    {
584      arg = argv[0];
585
586      shift ();
587
588      if (arg == "constituent_makefile")
589        {
590          cmt.m_action = action_build_constituent_makefile;
591          bool need_name (true);
592          while (argc > 0)
593            {
594              cmt_string arg(argv[0]);
595              if (arg.substr (0, 5) == "-out=")
596                {
597                  fill_one_argument ();
598                }
599              else if (arg == "-with_cmt")
600                {
601                  shift ();
602                  cmt.m_use_cmt = true;
603                }
604              else if (arg == "-without_cmt")
605                {
606                  shift ();
607                  cmt.m_use_cmt = false;
608                }
609              else if (need_name && arg != "")
610                {
611                  need_name = false;
612                  fill_one_argument ();
613                }
614              else
615                {
616                  help_action = action_help;
617                  CmtError::set (CmtError::syntax_error, arg + ": wrong argument");
618                  break;
619                }
620            }
621          if (need_name)
622            {
623              help_action = action_help;
624              if (!CmtError::has_pending_error ())
625                CmtError::set (CmtError::syntax_error, "argument(s) missing");
626            }
627        }
628      else if (arg == "constituent_config")
629        {
630          cmt.m_action = action_build_constituent_config;
631          bool need_name (true);
632          while (argc > 0)
633            {
634              cmt_string arg(argv[0]);
635              if (arg.substr (0, 5) == "-out=")
636                {
637                  fill_one_argument ();
638                }
639              else if (need_name && arg != "")
640                {
641                  need_name = false;
642                  fill_one_argument ();
643                }
644              else
645                {
646                  help_action = action_help;
647                  CmtError::set (CmtError::syntax_error, arg + ": wrong argument");
648                  break;
649                }
650            }
651          if (need_name)
652            {
653              help_action = action_help;
654              if (!CmtError::has_pending_error ())
655                CmtError::set (CmtError::syntax_error, "argument(s) missing");
656            }
657        }
658      else if (arg == "constituents_makefile")
659        {
660          cmt.m_action = action_build_constituents_makefile;
661          while (argc > 0)
662            {
663              cmt_string arg(argv[0]);
664              if (arg.substr (0, 5) == "-out=")
665                {
666                  fill_one_argument ();
667                }
668              else
669                {
670                  help_action = action_help;
671                  CmtError::set (CmtError::syntax_error, arg + ": wrong argument");
672                  break;
673                }
674            }
675        }
676      else if (arg == "constituents_config")
677        {
678          cmt.m_action = action_build_constituents_config;
679          while (argc > 0)
680            {
681              cmt_string arg(argv[0]);
682              if (arg.substr (0, 5) == "-out=" ||
683                  arg == "-with_cmt" ||
684                  arg == "-without_cmt")
685                {
686                  fill_one_argument ();
687                }
688              else
689                {
690                  help_action = action_help;
691                  CmtError::set (CmtError::syntax_error, arg + ": wrong argument");
692                  break;
693                }
694            }
695        }
696      else if (arg == "broadcast_config")
697        {
698          cmt.m_action = action_build_broadcast_config;
699
700          if (cmt.m_scope_filtering_mode == default_filtering_mode)
701            {
702              cmt.m_scope_filtering_mode = reach_private_uses;
703            }
704
705          while (argc > 0)
706            {
707              cmt_string arg(argv[0]);
708              if (arg.substr (0, 5) == "-out=")
709                {
710                  fill_one_argument ();
711                }
712              else
713                {
714                  help_action = action_help;
715                  CmtError::set (CmtError::syntax_error, arg + ": wrong argument");
716                  break;
717                }
718            }
719        }
720      else if (arg == "dependencies")
721        {
722          if (argc > 0)
723            {
724              //              fill_arguments ();
725              while (argc > 0)
726                {
727                  cmt_string arg(argv[0]);
728                  if (arg.substr (0, 3) == "-f=")
729                    {
730                      shift ();
731                      extra_file = arg.substr (3);
732                    }
733                  else if (arg.substr (0, 3) == "-e=")
734                    {
735                      shift ();
736                      extra_line = arg.substr (3);
737                    }
738                  else if (arg == "-with_cmt")
739                    {
740                      shift ();
741                      cmt.m_use_cmt = true;
742                    }
743                  else if (arg == "-without_cmt")
744                    {
745                      shift ();
746                      cmt.m_use_cmt = false;
747                    }
748                  else
749                    {
750                      fill_one_argument ();
751                    }
752                } 
753              cmt.m_action = action_build_dependencies;
754            }
755          else
756            {
757              //CmtMessage::error ("syntax: arguments missing");
758              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing " << endl;
759              CmtError::set (CmtError::syntax_error, "arguments missing");
760              help_action = action_help;
761              cmt.m_action = action_build_dependencies;
762            }
763        }
764      else if (arg == "library_links")
765        {
766          cmt.m_action = action_build_library_links;
767        }
768      else if (arg == "make_setup")
769        {
770          cmt.m_action = action_build_make_setup;
771        }
772      else if (arg == "msdev")
773        {
774          if (argc > 0)
775            {
776              fill_one_argument_filtered ();
777            }
778
779          cmt.m_action = action_build_msdev;
780        }
781      else if (arg == "CMT_pacman")
782        {
783          cmt.m_action = action_build_CMT_pacman;
784        }
785      else if (arg == "vsnet") 
786        {
787          if (argc > 0)
788            {
789              fill_one_argument_filtered ();
790            }
791                                                                   
792          cmt.m_action = action_build_vsnet;                 
793        }                                             
794      else if (arg == "os9_makefile")
795        {
796          if (argc > 0)
797            {
798              fill_one_argument ();
799              cmt.m_action = action_build_os9_makefile;
800            }
801          else
802            {
803              CmtMessage::error ("syntax: arguments missing");
804              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing " << endl;
805              help_action = action_help;
806              cmt.m_action = action_build_os9_makefile;
807            }
808        }
809      else if (arg == "prototype")
810        {
811          if (argc > 0)
812            {
813              fill_one_argument ();
814              cmt.m_action = action_build_prototype;
815            }
816          else
817            {
818              CmtMessage::error ("syntax: arguments missing");
819              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl;
820              help_action = action_help;
821              cmt.m_action = action_build_prototype;
822            }
823        }
824      else if (arg == "readme")
825        {
826          cmt.m_action = action_build_readme;
827
828          fill_arguments ();
829        }
830      else if (arg == "tag_makefile")
831        {
832          cmt.m_action = action_build_tag_makefile;
833        }
834      else if (arg == "temporary_name")
835        {
836          cmt.m_action = action_build_temporary_name;
837        }
838      else if (arg == "triggers")
839        {
840          if (argc > 0)
841            {
842              fill_one_argument ();
843              cmt.m_action = action_build_triggers;
844            }
845          else
846            {
847              CmtMessage::error ("syntax: arguments missing");
848              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl;
849              help_action = action_help;
850              cmt.m_action = action_build_triggers;
851            }
852        }
853      else if (arg == "windefs")
854        {
855          if (argc > 0)
856            {
857              //              fill_one_argument ();
858              fill_arguments ();
859              cmt.m_action = action_build_windefs;
860            }
861          else
862            {
863              CmtMessage::error ("syntax: arguments missing");
864              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl;
865              help_action = action_help;
866              cmt.m_action = action_build_windefs;
867            }
868        }
869      else
870        {
871          CmtError::set (CmtError::syntax_error, "wrong argument: " + arg);
872          //CmtMessage::error ("syntax: wrong build argument: " + arg);
873          //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : wrong build argument" << endl;
874          help_action = action_help;
875          cmt.m_action = action_build;
876        }
877    }
878  else
879    {
880      cmt.m_action = action_build;
881      if (help_action != action_help)
882        {
883          help_action = action_help;
884          CmtError::set (CmtError::syntax_error, "argument(s) missing");
885          //CmtMessage::error ("syntax: don't know what to build");
886      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to build" << endl;
887        }
888    }
889}
890
891void ArgParser::do_check ()
892{
893  if (argc > 0)
894    {
895      arg = argv[0];
896
897      shift ();
898
899      if (arg == "configuration")
900        {
901          cmt.m_action = action_check_configuration;
902          //cmt.m_warnings = true;
903        }
904      else if (arg == "files")
905        {
906          if (argc > 0)
907            {
908              fill_one_argument ();
909              if (argc > 0)
910                {
911                  fill_one_argument ();
912                  cmt.m_action = action_check_files;
913                }
914              else
915                {
916                  CmtMessage::error ("syntax: reference file name missing");
917                  //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : reference file name missing" << endl;
918                  help_action = action_help;
919                  cmt.m_action = action_check_files;
920                }
921            }
922          else
923            {
924              CmtMessage::error ("syntax: file name missing");
925              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : file name missing" << endl;
926              help_action = action_help;
927              cmt.m_action = action_check_files;
928            }
929        }
930      else if (arg == "version")
931        {
932          if (argc > 0)
933            {
934              fill_one_argument ();
935              cmt.m_action = action_check_version;
936            }
937          else
938            {
939              CmtMessage::error ("syntax: package name missing");
940              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : package name missing" << endl;
941              help_action = action_help;
942              cmt.m_action = action_check_version;
943            }
944        }
945      else
946        {
947          CmtMessage::error ("syntax: bad check option");
948          //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad check option" << endl;
949          help_action = action_help;
950          cmt.m_action = action_check;
951        }
952    }
953  else
954    {
955      CmtMessage::error ("syntax: don't know what to check");
956      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to check" << endl;
957      help_action = action_help;
958      cmt.m_action = action_check;
959    }
960}
961
962void ArgParser::do_check_files ()
963{
964  if (argc > 0)
965    {
966      fill_one_argument ();
967      if (argc > 0)
968        {
969          fill_one_argument ();
970          cmt.m_action = action_check_files;
971        }
972      else
973        {
974          CmtMessage::error ("syntax: reference file name missing");
975          help_action = action_help;
976          cmt.m_action = action_check_files;
977        }
978    }
979  else
980    {
981      CmtMessage::error ("syntax: file name missing");
982      help_action = action_help;
983      cmt.m_action = action_check_files;
984    }
985}
986
987void ArgParser::do_checkout ()
988{
989  if (argc > 0)
990    {
991      fill_arguments ();
992      cmt.m_action = action_checkout;
993    }
994  else
995    {
996      CmtError::set (CmtError::syntax_error, "checkout argument(s) missing");
997      //      CmtMessage::error ("syntax: checkout arguments missing");
998      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : checkout arguments missing" << endl;
999      help_action = action_help;
1000      cmt.m_action = action_checkout;
1001    }
1002}
1003
1004void ArgParser::do_cleanup ()
1005{
1006  cmt.m_action = action_cleanup;
1007}
1008
1009void ArgParser::do_config ()
1010{
1011  cmt.m_action = action_config;
1012}
1013
1014void ArgParser::do_create ()
1015{
1016  if (argc >= 2)
1017    //if (argc > 0)
1018    {
1019      fill_arguments ();
1020      cmt.m_action = action_create;
1021    }
1022  else
1023    {
1024      CmtError::set (CmtError::syntax_error, "arguments missing");
1025      //CmtMessage::error ("syntax: create arguments missing");
1026      help_action = action_help;
1027      cmt.m_action = action_create;
1028    }
1029}
1030
1031void ArgParser::do_create_project ()
1032{
1033  if (argc > 0)
1034    {
1035      fill_arguments ();
1036      cmt.m_action = action_create_project;
1037    }
1038  else
1039    {
1040      CmtMessage::error ("syntax: create_project arguments missing");
1041      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : create_project arguments missing" << endl;
1042      help_action = action_help;
1043      cmt.m_action = action_create_project;
1044    }
1045}
1046
1047void ArgParser::do_cvsbranches ()
1048{
1049  if (argc > 0)
1050    {
1051      fill_one_argument ();
1052      cmt.m_action = action_cvsbranches;
1053    }
1054  else
1055    {
1056      CmtMessage::error ("syntax: cvsbranches arguments missing");
1057      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : cvsbranches arguments missing" << endl;
1058      help_action = action_help;
1059      cmt.m_action = action_cvsbranches;
1060    }
1061}
1062
1063void ArgParser::do_cvssubpackages ()
1064{
1065  if (argc > 0)
1066    {
1067      fill_one_argument ();
1068    }
1069
1070  cmt.m_action = action_cvssubpackages;
1071}
1072
1073void ArgParser::do_cvssubprojects ()
1074{
1075  if (argc > 0)
1076    {
1077      fill_one_argument ();
1078    }
1079
1080  cmt.m_action = action_cvssubprojects;
1081}
1082
1083void ArgParser::do_cvstags ()
1084{
1085  if (argc > 0)
1086    {
1087      fill_arguments ();
1088      cmt.m_action = action_cvstags;
1089    }
1090  else
1091    {
1092      CmtMessage::error ("syntax: package name missing");
1093      help_action = action_help;
1094      cmt.m_action = action_cvstags;
1095    }
1096}
1097
1098void ArgParser::do_do ()
1099{
1100  if (argc > 0)
1101    {
1102      fill_arguments ();
1103                 
1104      {
1105        cmt_string tag_name = "target_";
1106        tag_name += arguments[0];
1107
1108        Tag* tag;
1109        tag = Tag::add (tag_name, PriorityUserTag, "action", 0);                     
1110        tag->mark ("action");
1111      }
1112
1113      cmt.m_action = action_do;
1114    }
1115  else
1116    {
1117      CmtMessage::error ("syntax: action not specified");
1118      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : action not specified" << endl;
1119      help_action = action_help;
1120      cmt.m_action = action_do;
1121    }
1122}
1123
1124void ArgParser::do_expand ()
1125{
1126  if (argc > 0)
1127    {
1128      arg = argv[0];
1129
1130      shift ();
1131      if (arg == "model")
1132        {
1133          if (argc > 0)
1134            {
1135              fill_arguments ();
1136              cmt.m_action = action_expand_model;
1137            }
1138          else
1139            {
1140              CmtMessage::error ("syntax: model not specified");
1141              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : model not specified" << endl;
1142              help_action = action_help;
1143              cmt.m_action = action_expand_model;
1144            }
1145        }
1146      else
1147        {
1148          CmtMessage::error ("syntax: bad expand option");
1149          //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad expand option" << endl;
1150          help_action = action_help;
1151          cmt.m_action = action_expand_model;
1152        }
1153    }
1154  else
1155    {
1156      CmtMessage::error ("syntax: don't know what to expand");
1157      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to expand" << endl;
1158      help_action = action_help;
1159      cmt.m_action = action_expand_model;
1160    }
1161}
1162
1163void ArgParser::do_filter ()
1164{
1165  if (argc > 0)
1166    {
1167      fill_arguments ();
1168      cmt.m_action = action_filter;
1169    }
1170  else
1171    {
1172      CmtMessage::error ("syntax: file to filter not specified");
1173      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : file to filter not specified" << endl;
1174      help_action = action_help;
1175      cmt.m_action = action_filter;
1176    }
1177}
1178
1179void ArgParser::do_help ()
1180{
1181  help_action = action_help;
1182}
1183
1184void ArgParser::do_lock ()
1185{
1186  if (argc > 0)
1187    {
1188      cmt.m_current_package = fill_one_argument ();
1189      cmt.m_current_version.erase (0);
1190      cmt.m_current_path.erase (0);
1191
1192      if (argc > 0)
1193        {
1194          cmt.m_current_version = fill_one_argument ();
1195          cmt.m_action = action_lock;
1196
1197          if (argc > 0)
1198            {
1199              cmt.m_current_path = fill_one_argument_filtered ();
1200            }
1201
1202          cmt.m_current_access = UserMode;
1203          (Use::current()).set (cmt.m_current_package, 
1204                                cmt.m_current_version, 
1205                                cmt.m_current_path);
1206
1207        }
1208      else
1209        {
1210          CmtMessage::error ("syntax: version missing");
1211          //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : version missing" << endl;
1212          help_action = action_help;
1213          cmt.m_action = action_lock;
1214        }
1215    }
1216  else
1217    {
1218      cmt.m_action = action_lock;
1219    }
1220}
1221
1222
1223void ArgParser::do_relocate ()
1224{
1225  cmt.m_action = action_relocate;
1226}
1227
1228
1229void ArgParser::do_remove ()
1230{
1231  if (argc > 0)
1232    {
1233      arg = argv[0];
1234
1235      if (arg == "library_links")
1236        {
1237          shift ();
1238          cmt.m_action = action_remove_library_links;
1239        }
1240      else
1241        {
1242          cmt.m_current_package = fill_one_argument ();
1243          cmt.m_current_version.erase (0);
1244          cmt.m_current_path.erase (0);
1245                     
1246          if (argc > 0)
1247            {
1248              cmt.m_current_version = fill_one_argument ();
1249
1250              if (argc > 0)
1251                {
1252                  cmt.m_current_path = fill_one_argument_filtered ();
1253                }
1254                           
1255              cmt.m_action = action_remove;
1256            }
1257          else
1258            {
1259              CmtMessage::error ("syntax: version missing");
1260              help_action = action_help;
1261              cmt.m_action = action_remove;
1262            }
1263        }
1264    }
1265  else
1266    {
1267      CmtMessage::error ("syntax: don't know what to remove");
1268      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to remove" << endl;
1269      help_action = action_help;
1270      cmt.m_action = action_remove;
1271    }
1272}
1273
1274void ArgParser::do_run ()
1275{
1276  if (argc > 0)
1277    {
1278      fill_arguments ();
1279      cmt.m_action = action_run;
1280    }
1281  else
1282    {
1283      CmtMessage::error ("syntax: run arguments missing");
1284      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : run arguments missing" << endl;
1285      help_action = action_help;
1286      cmt.m_action = action_run;
1287    }
1288}
1289
1290void ArgParser::do_run_sequence ()
1291{
1292  if (argc > 0)
1293    {
1294      fill_one_argument ();
1295      cmt.m_action = action_run_sequence;
1296    }
1297  else
1298    {
1299      CmtMessage::error ("syntax: run_sequence arguments missing");
1300      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : run_sequence arguments missing" << endl;
1301      help_action = action_help;
1302      cmt.m_action = action_run_sequence;
1303    }
1304}
1305
1306void ArgParser::do_set ()
1307{
1308  if (argc > 0)
1309    {
1310      arg = argv[0];
1311
1312      shift ();
1313
1314      if (arg == "version")
1315        {
1316          fill_arguments ();
1317          cmt.m_action = action_set_version;
1318        }
1319      else if (arg == "versions")
1320        {
1321          fill_arguments ();
1322
1323          cmt.m_action = action_set_versions;
1324
1325          if (cmt.m_scope_filtering_mode == default_filtering_mode)
1326            {
1327              cmt.m_scope_filtering_mode = reach_private_uses;
1328            }
1329        }
1330      else
1331        {
1332          CmtMessage::error ("syntax: bad set argument");
1333          //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad set argument" << endl;
1334          help_action = action_help;
1335          //cmt.m_action = action_set;
1336        }
1337    }
1338  else
1339    {
1340      CmtMessage::error ("syntax: don't know what to set");
1341      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to set" << endl;
1342      help_action = action_help;
1343      //cmt.m_action = action_set;
1344    }
1345}
1346
1347void ArgParser::do_setup ()
1348{
1349  cmt.m_action = action_setup;
1350  //cmt.m_warnings = true;
1351}
1352
1353void ArgParser::do_show ()
1354{
1355  if (argc > 0)
1356    {
1357      arg = argv[0];
1358
1359      //cerr << "Running show arg=" << arg << endl;
1360
1361      shift ();
1362
1363      if (arg == "action")
1364        {
1365          if (argc > 0)
1366            {
1367              cmt.m_current_target = fill_one_argument ();
1368              cmt.m_action = action_show_action;
1369            }
1370          else
1371            {
1372              CmtMessage::error ("syntax: action name missing");
1373              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : action name missing" << endl;
1374              help_action = action_help;
1375              cmt.m_action = action_show_action;
1376            }
1377        }
1378      else if (arg == "action_names")
1379        {
1380          if (argc > 0)
1381            {
1382              fill_one_argument ();
1383            }
1384
1385          cmt.m_action = action_show_action_names;
1386        }
1387      else if (arg == "action_value")
1388        {
1389          cmt.m_quiet = true;
1390          if (argc > 0)
1391            {
1392              cmt.m_current_target = fill_one_argument ();
1393              cmt.m_action = action_show_action_value;
1394            }
1395          else
1396            {
1397              CmtMessage::error ("syntax: action name missing");
1398              help_action = action_help;
1399              cmt.m_action = action_show_action_value;
1400            }
1401        }
1402      else if (arg == "actions")
1403        {
1404          if (argc > 0)
1405            {
1406              fill_one_argument ();
1407            }
1408
1409          cmt.m_action = action_show_actions;
1410        }
1411      else if (arg == "alias")
1412        {
1413          if (argc > 0)
1414            {
1415              cmt.m_current_target = fill_one_argument ();
1416              cmt.m_action = action_show_alias;
1417            }
1418          else
1419            {
1420              CmtError::set (CmtError::syntax_error, "alias name missing");
1421              //CmtMessage::error ("syntax: alias name missing");
1422              help_action = action_help;
1423              cmt.m_action = action_show_alias;
1424            }
1425        }
1426      else if (arg == "alias_names")
1427        {
1428          if (argc > 0)
1429            {
1430              fill_one_argument ();
1431            }
1432
1433          cmt.m_action = action_show_alias_names;
1434        }
1435      else if (arg == "alias_value")
1436        {
1437          cmt.m_quiet = true;
1438          if (argc > 0)
1439            {
1440              cmt.m_current_target = fill_one_argument ();
1441              cmt.m_action = action_show_alias_value;
1442            }
1443          else
1444            {
1445              CmtError::set (CmtError::syntax_error, "alias name missing");
1446              //CmtMessage::error ("syntax: alias name missing");
1447              help_action = action_help;
1448              cmt.m_action = action_show_alias_value;
1449            }
1450        }
1451      else if (arg == "aliases")
1452        {
1453          if (argc > 0)
1454            {
1455              fill_one_argument ();
1456            }
1457
1458          cmt.m_action = action_show_aliases;
1459        }
1460      else if (arg == "all_tags")
1461        {
1462          cmt.m_action = action_show_all_tags;
1463        }
1464      else if (arg == "applied_patterns")
1465        {
1466          cmt.m_action = action_show_applied_patterns;
1467        }
1468      else if (arg == "author")
1469        {
1470          cmt.m_action = action_show_author;
1471        }
1472      else if (arg == "branches")
1473        {
1474          cmt.m_action = action_show_branches;
1475        }
1476      else if (arg == "clients")
1477        {
1478          if (argc > 0)
1479            {
1480              cmt.m_current_target = fill_one_argument ();
1481
1482              cmt.m_action = action_show_clients;
1483
1484              if (argc > 0)
1485                {
1486                  fill_one_argument ();
1487                  if (argc > 0)
1488                    {
1489                      fill_one_argument ();
1490                    }
1491                }
1492            }
1493          else
1494            {
1495              CmtMessage::error ("syntax: package name missing");
1496              help_action = action_help;
1497              cmt.m_action = action_show_clients;
1498            }
1499        }
1500      else if (arg == "cmtpath_patterns")
1501        {
1502          cmt.m_action = action_show_cmtpath_patterns;
1503        }
1504      else if (arg == "constituent")
1505        {
1506          if (argc > 0)
1507            {
1508              cmt.m_current_target = fill_one_argument ();
1509              cmt.m_action = action_show_constituent;
1510            }
1511          else
1512            {
1513              CmtMessage::error ("syntax: constituent name missing");
1514              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : constituent name missing" << endl;
1515              help_action = action_help;
1516              cmt.m_action = action_show_constituent;
1517            }
1518        }
1519      else if (arg == "constituent_names")
1520        {
1521          cmt.m_action = action_show_constituent_names;
1522        }
1523      else if (arg == "constituents")
1524        {
1525          cmt.m_action = action_show_constituents;
1526        }
1527      else if (arg == "container")
1528        {
1529          if (argc > 0)
1530            {
1531              fill_arguments ();
1532            }
1533          cmt.m_action = action_show_container;
1534        }
1535      else if (arg == "cycles")
1536        {
1537          cmt.m_action = action_show_cycles;
1538        }
1539      else if (arg == "fragment")
1540        {
1541          if (argc > 0)
1542            {
1543              cmt.m_current_target = fill_one_argument ();
1544              cmt.m_action = action_show_fragment;
1545            }
1546          else
1547            {
1548              CmtMessage::error ("syntax: fragment name missing");
1549              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : fragment name missing" << endl;
1550              help_action = action_help;
1551              cmt.m_action = action_show_fragment;
1552            }
1553        }
1554      else if (arg == "fragments")
1555        {
1556          cmt.m_action = action_show_fragments;
1557        }
1558      else if (arg == "groups")
1559        {
1560          cmt.m_action = action_show_groups;
1561        }
1562      else if (arg == "include_dirs")
1563        {
1564          cmt.m_action = action_show_include_dirs;
1565        }
1566      else if (arg == "language")
1567        {
1568          if (argc > 0)
1569            {
1570              cmt.m_current_target = fill_one_argument ();
1571              cmt.m_action = action_show_language;
1572            }
1573          else
1574            {
1575              CmtMessage::error ("syntax: language name missing");
1576              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : language name missing" << endl;
1577              help_action = action_help;
1578              cmt.m_action = action_show_language;
1579            }
1580        }
1581      else if (arg == "languages")
1582        {
1583          cmt.m_action = action_show_languages;
1584        }
1585      else if (arg == "macro")
1586        {
1587          if (argc > 0)
1588            {
1589              cmt.m_current_target = fill_one_argument ();
1590              cmt.m_action = action_show_macro;
1591            }
1592          else
1593            {
1594              CmtMessage::error ("syntax: macro name missing");
1595              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : macro name missing" << endl;
1596              help_action = action_help;
1597              cmt.m_action = action_show_macro;
1598            }
1599        }
1600      else if (arg == "macro_names")
1601        {
1602          if (argc > 0)
1603            {
1604              fill_one_argument ();
1605            }
1606
1607          cmt.m_action = action_show_macro_names;
1608        }
1609      else if (arg == "macro_value")
1610        {
1611          cmt.m_quiet = true;
1612          if (argc > 0)
1613            {
1614              cmt.m_current_target = fill_one_argument ();
1615              cmt.m_action = action_show_macro_value;
1616            }
1617          else
1618            {
1619              CmtMessage::error ("syntax: macro name missing");
1620              help_action = action_help;
1621              cmt.m_action = action_show_macro_value;
1622            }
1623        }
1624      else if (arg == "macros")
1625        {
1626          if (argc > 0)
1627            {
1628              fill_one_argument ();
1629            }
1630
1631          cmt.m_action = action_show_macros;
1632        }
1633      else if (arg == "manager")
1634        {
1635          cmt.m_action = action_show_manager;
1636        }
1637      else if (arg == "packages")
1638        {
1639          if (argc > 0)
1640            {
1641              fill_arguments ();
1642              //              cmt.m_current_target = fill_one_argument ();
1643            }
1644
1645          cmt.m_action = action_show_packages;
1646        }
1647      else if (arg == "path")
1648        {
1649          if (argc == 0)
1650            {
1651              cmt.m_action = action_show_path;
1652            }
1653          else if (argc == 1 && cmt_string (argv[0]) == "-d")
1654            {
1655              fill_one_argument ();
1656              cmt.m_action = action_show_path;
1657            }
1658          else
1659            {
1660              cmt.m_action = action_show_path;
1661              help_action = action_help;
1662            }
1663        }
1664      else if (arg == "pattern")
1665        {
1666          if (argc > 0)
1667            {
1668              cmt.m_current_target = fill_one_argument ();
1669              cmt.m_action = action_show_pattern;
1670            }
1671          else
1672            {
1673              CmtMessage::error ("syntax: pattern name missing");
1674              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : pattern name missing" << endl;
1675              help_action = action_help;
1676              cmt.m_action = action_show_pattern;
1677            }
1678        }
1679      else if (arg == "pattern_names")
1680        {
1681          cmt.m_action = action_show_pattern_names;
1682        }
1683      else if (arg == "patterns")
1684        {
1685          cmt.m_action = action_show_patterns;
1686        }
1687      else if (arg == "projects")
1688        {
1689          cmt.m_action = action_show_projects;
1690        }
1691        else if (arg == "project_author")
1692        {
1693          cmt.m_action = action_show_project_author;
1694        }
1695
1696      else if (arg == "pwd")
1697        {
1698          cmt.m_action = action_show_pwd;
1699        }
1700      else if (arg == "setup")
1701        {
1702          cmt.m_action = action_show_setup;
1703
1704          if (cmt.m_scope_filtering_mode == default_filtering_mode)
1705            {
1706              cmt.m_scope_filtering_mode = reach_private_uses;
1707            }
1708        }
1709      else if (arg == "set_names")
1710        {
1711          if (argc > 0)
1712            {
1713              fill_one_argument ();
1714            }
1715
1716          cmt.m_action = action_show_set_names;
1717        }
1718      else if (arg == "set_value")
1719        {
1720          cmt.m_quiet = true;
1721          if (argc > 0)
1722            {
1723              cmt.m_current_target = fill_one_argument ();
1724              cmt.m_action = action_show_set_value;
1725            }
1726          else
1727            {
1728              CmtMessage::error ("syntax: set name missing");
1729              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : set name missing" << endl;
1730              help_action = action_help;
1731              cmt.m_action = action_show_set_value;
1732            }
1733        }
1734      else if (arg == "set")
1735        {
1736          if (argc > 0)
1737            {
1738              cmt.m_current_target = fill_one_argument ();
1739              cmt.m_action = action_show_set;
1740            }
1741          else
1742            {
1743              CmtMessage::error ("syntax: set name missing");
1744              help_action = action_help;
1745              cmt.m_action = action_show_set;
1746            }
1747        }
1748      else if (arg == "sets")
1749        {
1750          if (argc > 0)
1751            {
1752              fill_one_argument ();
1753            }
1754
1755          cmt.m_action = action_show_sets;
1756        }
1757      else if (arg == "strategies")
1758        {
1759          cmt.m_action = action_show_strategies;
1760        }
1761      else if (arg == "tags")
1762        {
1763          cmt.m_action = action_show_tags;
1764        }
1765      else if (arg == "use_paths")
1766        {
1767          if (argc > 0)
1768            {
1769              while (argc > 0)
1770                {
1771                  if (strcmp (argv[0], "-private") == 0)
1772                    {
1773                      cmt.m_scope_filtering_mode = reach_private_uses;
1774                    }
1775                  else if (strcmp (argv[0], "--private") == 0)
1776                    {
1777                      cmt.m_scope_filtering_mode = reach_private_uses;
1778                    }
1779                  else
1780                    {
1781                      cmt_string& s = arguments.add ();
1782                      s = argv[0];
1783                    }
1784
1785                  shift ();
1786                }
1787
1788              cmt.m_action = action_show_use_paths;
1789            }
1790          else
1791            {
1792              CmtMessage::error ("syntax: package name missing");
1793              help_action = action_help;
1794              cmt.m_action = action_show_use_paths;
1795            }
1796        }
1797      else if ((arg == "u") ||
1798               (arg == "us") ||
1799               (arg == "use") ||
1800               (arg == "uses"))
1801        {
1802          cmt.m_action = action_show_uses;
1803
1804          if (cmt.m_scope_filtering_mode == default_filtering_mode)
1805            {
1806              cmt.m_scope_filtering_mode = reach_private_uses;
1807            }
1808        }
1809      else if (arg == "version")
1810        {
1811          cmt.m_action = action_show_version;
1812        }
1813      else if (arg == "versions")
1814        {
1815          if (argc > 0)
1816            {
1817              cmt.m_current_target = fill_one_argument ();
1818              cmt.m_action = action_show_versions;
1819            }
1820          else
1821            {
1822              CmtMessage::error ("syntax: package name missing");
1823              help_action = action_help;
1824              cmt.m_action = action_show_versions;
1825            }
1826        }
1827      else
1828        {
1829          CmtMessage::error ("syntax: bad show argument");
1830          //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad show argument" << endl;
1831          help_action = action_help;
1832          cmt.m_action = action_show;
1833        }
1834    }
1835  else
1836    {
1837      CmtMessage::error ("syntax: don't know what to show");
1838      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to show" << endl;
1839      help_action = action_help;
1840      cmt.m_action = action_show;
1841    }
1842}
1843
1844void ArgParser::do_system ()
1845{
1846  cmt.m_action = action_system;
1847}
1848
1849void ArgParser::do_unlock ()
1850{
1851  if (argc > 0)
1852    {
1853      cmt.m_current_package = fill_one_argument ();
1854      cmt.m_current_version.erase (0);
1855      cmt.m_current_path.erase (0);
1856                                       
1857      if (argc > 0)
1858        {
1859          cmt.m_current_version = fill_one_argument ();
1860          cmt.m_action = action_unlock;
1861
1862          if (argc > 0)
1863            {
1864              cmt.m_current_path = fill_one_argument_filtered ();
1865            }
1866                                               
1867          cmt.m_current_access = UserMode;
1868          (Use::current()).set (cmt.m_current_package, 
1869                                cmt.m_current_version, 
1870                                cmt.m_current_path);
1871
1872        }
1873      else
1874        {
1875          CmtMessage::error ("syntax: version missing");
1876          help_action = action_help;
1877          cmt.m_action = action_unlock;
1878        }
1879    }
1880  else
1881    {
1882      cmt.m_action = action_unlock;
1883    }
1884}
1885
1886void ArgParser::do_version ()
1887{
1888  cmt.m_action = action_version;
1889}
1890
1891void ArgParser::option_help ()
1892{
1893  help_action = action_help;
1894}
1895
1896void ArgParser::option_n ()
1897{
1898  cmt.m_simulation = true;
1899}
1900
1901
1902void ArgParser::option_disable_warnings ()
1903{
1904  cmt.m_disable_warnings = true;
1905//   if (CmtMessage::level () <= Warning)
1906//     CmtMessage::set_level (Error);
1907  if (!Cmt::add_cmt_flag ("-disable_warnings"))
1908    CmtError::set (CmtError::system_error, "Cannot add flag `-disable_warnings'");
1909}
1910
1911void ArgParser::option_quiet ()
1912{
1913  cmt.m_quiet = true;
1914//   if (CmtMessage::level () <= Error)
1915//     CmtMessage::set_level (Fatal);
1916  if (!Cmt::add_cmt_flag ("-quiet"))
1917    CmtError::set (CmtError::system_error, "Cannot add flag `-quiet'");
1918}
1919
1920
1921void ArgParser::option_warnings ()
1922{
1923  cmt.m_warnings = true;
1924//   if (CmtMessage::level () != Warning)
1925//     CmtMessage::set_level (Warning);
1926  if (!Cmt::add_cmt_flag ("-warnings"))
1927    CmtError::set (CmtError::system_error, "Cannot add flag `-warnings'");
1928}
1929
1930void ArgParser::option_csh ()
1931{
1932  mode = Csh;
1933}
1934
1935void ArgParser::option_sh ()
1936{
1937  mode = Sh;
1938}
1939
1940void ArgParser::option_bat ()
1941{
1942  mode = Bat;
1943}
1944
1945void ArgParser::option_requirements ()
1946{
1947  mode = Requirements;
1948}
1949
1950void ArgParser::option_xml ()
1951{
1952  mode = Xml;
1953}
1954
1955void ArgParser::option_use ()
1956{
1957  if (cmt.m_action != action_create)
1958    {
1959      CmtSystem::cmt_string_vector words;
1960      CmtSystem::split (arg, ":", words);
1961
1962      cmt.m_current_access = UserMode;
1963
1964      cmt.m_current_package = "";
1965      cmt.m_current_version = "";
1966      cmt.m_current_path = "";
1967
1968      if (words.size () > 0) cmt.m_current_package = words[0];
1969      if (words.size () > 1) cmt.m_current_version = words[1];
1970      if (words.size () > 2) cmt.m_current_path    = words[2];
1971    }
1972}
1973
1974void ArgParser::option_pack ()
1975{
1976  if ((cmt.m_action != action_create) && (cmt.m_current_package != arg))
1977    {
1978      //CmtSystem::cd (cmt.m_default_path);
1979
1980      cmt.m_current_access = UserMode;
1981
1982      cmt.m_current_package = arg;
1983      //      cmt.m_current_version = "";
1984
1985    }
1986}
1987
1988void ArgParser::option_version ()
1989{
1990  if ((cmt.m_action != action_create) && (cmt.m_current_version != arg))
1991    {
1992      cmt.m_current_access = UserMode;
1993      cmt.m_current_version = arg;
1994    }
1995}
1996
1997void ArgParser::option_path ()
1998{
1999  if ((cmt.m_action != action_create) && (cmt.m_current_path != arg))
2000    {
2001      cmt.m_current_access = UserMode;
2002      cmt.m_current_path = arg;
2003    }
2004}
2005
2006void ArgParser::option_f ()
2007{
2008  extra_file = arg;
2009}
2010
2011void ArgParser::option_e ()
2012{
2013  extra_line = arg;
2014}
2015
2016void ArgParser::option_home ()
2017{
2018  if (CmtSystem::test_directory (arg))
2019    {
2020      cmt.m_cmt_home = arg;
2021    }
2022}
2023
2024void ArgParser::option_tag ()
2025{
2026  /*
2027    Here we are going to change the complete tag set
2028  */
2029  if (arg != "")
2030    {
2031      cmt.m_tags.clear ();
2032      CmtSystem::cmt_string_vector words;
2033      CmtSystem::split (arg, " \t,", words);
2034      for (int i = 0; i < words.size (); i++)
2035        {
2036          bool has (false);
2037          for (int j = 0; j < cmt.m_tags.size (); j++)
2038            {
2039              if (cmt.m_tags[j] == words[i])
2040                {
2041                  has = true;
2042                  break;
2043                }
2044            }
2045          if (!has)
2046            cmt.m_tags.push_back (words[i]);
2047        }
2048
2049      if (cmt.m_tags.size () != 0)
2050        {
2051          cmt.m_extra_tags.clear ();
2052          cmt.m_tags_add.clear ();
2053          cmt.m_tags_remove.clear ();
2054        }
2055
2056      /*
2057      Tag* tag;
2058      CmtSystem::cmt_string_vector words;
2059
2060      // First reset selection of all existing tags
2061      //Tag::clear_all ();
2062      Tag::unmark_all ();
2063      cmt.m_extra_tags = ",";
2064                   
2065      // Then restore CMTSITE
2066      Cmt::configure_version_tag ();
2067      Cmt::configure_site_tag (0);
2068      Cmt::configure_uname_tag ();
2069      Cmt::configure_hosttype_tag ();
2070      Cmt::configure_config_tag ();
2071      Cmt::configure_home (0);
2072      Cmt::guess_current_project ();
2073
2074      CmtSystem::split (arg, " \t,", words);
2075                 
2076      for (int i = 0; i < words.size (); i++)
2077        {
2078          const cmt_string& a = words[i];
2079      //if (!cmt.m_quiet) cout  << "parse_argument(tag_add)> current_tag=" << a << endl;                     
2080          cmt_string s = ",";
2081          s += a;
2082          s += ",";
2083                     
2084          if (i == 0)
2085            {
2086              cmt.m_current_tag = a;
2087                         
2088              if (CmtSystem::testenv ("TAGDEBUG"))
2089              cerr << "parse_argument(tag_add)> current_tag=" << cmt.m_current_tag << endl;
2090            }
2091                     
2092          if (cmt.m_extra_tags.find (s) == cmt_string::npos)
2093            {
2094              //if (!cmt.m_quiet) cerr << "  a=[" << a << "]" << endl;
2095                         
2096              // Then restore uname if the specified tag is CMTCONFIG
2097              if (a == CmtSystem::get_cmt_config ())
2098                {
2099                  Cmt::configure_uname_tag ();
2100                }
2101                         
2102              tag = Tag::add (a, PriorityArgument, "arguments", 0);
2103              tag->mark ("arguments");
2104              cmt.m_extra_tags += a;
2105              cmt.m_extra_tags += ",";
2106            }
2107        }
2108        // To be sure that a tag
2109        Cmt::guess_current_project ();
2110      */
2111    }
2112}
2113
2114void ArgParser::option_tag_add ()
2115{
2116  CmtSystem::cmt_string_vector words;
2117  CmtSystem::split (arg, " \t,", words);
2118  for (int i = 0; i < words.size (); i++)
2119    {
2120      bool has (false);
2121      for (int j = 0; j < cmt.m_tags_add.size (); j++)
2122        {
2123          if (cmt.m_tags_add[j] == words[i])
2124            {
2125              has = true;
2126              break;
2127            }
2128        }
2129      if (!has)
2130        {
2131          cmt.m_tags_add.push_back (words[i]);
2132        }
2133     
2134      for (int j = 0; j < cmt.m_tags_remove.size (); j++)
2135        {
2136          if (cmt.m_tags_remove[j] == words[i])
2137            {
2138              cmt.m_tags_remove.erase(j);
2139              break;
2140            }
2141        }
2142    }
2143  /*
2144  Tag* tag;
2145  CmtSystem::cmt_string_vector words;
2146 
2147
2148  CmtSystem::split (arg, " \t,", words);
2149
2150  for (int i = 0; i < words.size (); i++)
2151    {
2152      const cmt_string& a = words[i];
2153
2154      cmt_string s = ",";
2155      s += a;
2156      s += ",";
2157
2158      if (cmt.m_extra_tags.find (s) == cmt_string::npos)
2159        {
2160          //if (!cmt.m_quiet) cerr << "  a=[" << a << "]" << endl;
2161
2162          /// Then restore uname if the specified tag is CMTCONFIG
2163          if (a == CmtSystem::get_cmt_config ())
2164            {
2165              Cmt::configure_uname_tag ();
2166            }
2167                     
2168          tag = Tag::add (a, PriorityUserTag, "arguments", 0);
2169                     
2170          tag->mark ("arguments");
2171
2172          cmt.m_extra_tags += a;
2173          cmt.m_extra_tags += ",";
2174        }
2175    }
2176  */
2177}
2178
2179void ArgParser::option_tag_remove ()
2180{
2181  CmtSystem::cmt_string_vector words;
2182  CmtSystem::split (arg, " \t,", words);
2183  for (int i = 0; i < words.size (); i++)
2184    {
2185      bool has (false);
2186      for (int j = 0; j < cmt.m_tags_remove.size (); j++)
2187        {
2188          if (cmt.m_tags_remove[j] == words[i])
2189            {
2190              has = true;
2191              break;
2192            }
2193        }
2194      if (!has)
2195        {
2196          cmt.m_tags_remove.push_back (words[i]);
2197        }
2198
2199      for (int j = 0; j < cmt.m_extra_tags.size (); j++)
2200        {
2201          if (cmt.m_extra_tags[j] == words[i])
2202            {
2203              cmt.m_extra_tags.erase(j);
2204              break;
2205            }
2206        }
2207      for (int j = 0; j < cmt.m_tags.size (); j++)
2208        {
2209          if (cmt.m_tags[j] == words[i])
2210            {
2211              cmt.m_tags.erase(j);
2212              break;
2213            }
2214        }
2215      for (int j = 0; j < cmt.m_tags_add.size (); j++)
2216        {
2217          if (cmt.m_tags_add[j] == words[i])
2218            {
2219              cmt.m_tags_add.erase(j);
2220              break;
2221            }
2222        }
2223    }
2224  /*
2225  Tag::TagPtrVector tags = Tag::tags ();
2226  int i;
2227  Tag* tag;
2228
2229  CmtSystem::cmt_string_vector words;
2230
2231  //if (!cmt.m_quiet) cerr << "-arg_remove=" << arg << endl;
2232
2233  CmtSystem::split (arg, " \t,", words);
2234
2235  //
2236  // Now erase all entries in the old list that match
2237  // the specified tags
2238  //
2239
2240  for (i = 0; i < words.size (); i++)
2241    {
2242      const cmt_string& a = words[i];
2243
2244      cmt_string s = ",";
2245      s += a;
2246      s += ",";
2247
2248      int pos;
2249
2250      pos = cmt.m_extra_tags.find (s);
2251
2252      if (pos != cmt_string::npos)
2253        {
2254          cmt.m_extra_tags.erase (pos, s.size () - 1);
2255        }
2256
2257      //if (!cmt.m_quiet) cerr << "  tag_list=[" << tag_list << "]" << endl;
2258    }
2259
2260  //
2261  // Now reinject the purged list of tags into the database
2262  // exactly as when using -tag=<tag-list>
2263  //
2264
2265  /// First forget about all existing tags
2266      Tag::unmark_all ();
2267
2268      /// Then restore CMTSITE
2269        Cmt::configure_version_tag ();
2270        Cmt::configure_site_tag (0);
2271        Cmt::configure_uname_tag ();
2272        Cmt::configure_hosttype_tag ();
2273             
2274        CmtSystem::split (cmt.m_extra_tags, " \t,", words);
2275
2276        for (i = 0; i < words.size (); i++)
2277          {
2278            const cmt_string& a = words[i];
2279
2280            /// Then restore uname if the specified tag is CMTCONFIG
2281              if (a == CmtSystem::get_cmt_config ())
2282                {
2283                  Cmt::configure_uname_tag ();
2284                }
2285
2286              if (i == 0)
2287                {
2288                  cmt.m_current_tag = a;
2289
2290                  //if (!cmt.m_quiet) cerr << "parse_argument(tag_remove)> current_tag="
2291                  //<< cmt.m_current_tag << endl;
2292
2293                  tag = Tag::add (a, PriorityTag, "arguments", 0);
2294                }
2295              else
2296                {
2297                  tag = Tag::add (a, PriorityUserTag, "arguments", 0);
2298                }
2299
2300              tag->mark ("arguments");
2301          }
2302  */
2303}
2304
2305void ArgParser::option_user_context ()
2306{
2307  if (CmtSystem::test_directory (arg))
2308    {
2309      cmt.m_cmt_user_context = arg;
2310    }
2311}
2312
2313void ArgParser::option_with_cmt ()
2314{
2315  cmt.m_use_cmt = true;
2316  if (!Cmt::add_cmt_flag ("-with_cmt"))
2317    CmtMessage::error ("Cannot add flag `-with_cmt'");
2318}
2319
2320void ArgParser::option_without_cmt ()
2321{
2322  cmt.m_use_cmt = false;
2323  if (!Cmt::add_cmt_flag ("-without_cmt"))
2324    CmtMessage::error ("Cannot add flag `-without_cmt'");
2325}
2326
2327void ArgParser::option_with_version_directory ()
2328{
2329  cmt.m_current_structuring_style = with_version_directory;
2330
2331  if (!Cmt::add_cmt_flag ("-with_version_directory"))
2332    CmtError::set (CmtError::system_error, "Cannot add flag `-with_version_directory'");
2333
2334}
2335
2336void ArgParser::option_without_version_directory ()
2337{
2338  cmt.m_current_structuring_style = without_version_directory;
2339
2340  if (!Cmt::add_cmt_flag ("-without_version_directory"))
2341    CmtError::set (CmtError::system_error, "Cannot add flag `-without_version_directory'");
2342
2343}
2344
2345void ArgParser::option_no_cleanup ()
2346{
2347  //cmt.m_current_setup_strategy |= SetupNoCleanup;
2348}
2349
2350void ArgParser::option_private ()
2351{
2352  cmt.m_scope_filtering_mode = reach_private_uses;
2353}
2354
2355void ArgParser::option_public ()
2356{
2357  cmt.m_scope_filtering_mode = block_private_uses;
2358}
2359
2360
2361
2362
2363
2364
2365CommandHelp::HelpMap& CommandHelp::get_help ()
2366{
2367  static CommandHelp& me = instance ();
2368
2369  return (me.m_help);
2370}
2371
2372CommandHelp::HelpTexts& CommandHelp::get_help_texts ()
2373{
2374  static CommandHelp& me = instance ();
2375
2376  return (me.m_help_texts);
2377}
2378
2379const cmt_string& CommandHelp::get_help_text (ActionType key)
2380{
2381  static const HelpTexts& help = get_help_texts ();
2382
2383  const cmt_string& h = help[key];
2384  return (h);
2385}
2386
2387void CommandHelp::show_all ()
2388{
2389  static HelpTexts& help_texts = get_help_texts ();
2390
2391  cout << "#> cmt command [option...]" << endl;
2392  cout << "# command :" << endl;
2393
2394  int i;
2395
2396  for (i = 0; ; i++)
2397    {
2398      const cmt_string& s = help_texts[i];
2399      if (s == "") break;
2400      cout << "#   " << s << endl;
2401    }
2402
2403  cout << "# global options :" << endl;
2404
2405  cout << "#   -disable_warnings       : don't print warnings" << endl;
2406  cout << "#   -quiet                  : don't print errors" << endl;
2407  cout << "#   -use=<p>:<v>:<path>     : set package version path" << endl;
2408  cout << "#   -pack=<package>         : set package" << endl;
2409  cout << "#   -version=<version>      : set version" << endl;
2410  cout << "#   -path=<path>            : set root path" << endl;
2411  cout << "#   -f=<requirements-file>  : set input file" << endl;
2412  cout << "#   -e=<statement(s)>       : add (multiple) statement(s)" << endl;
2413  cout << "#   -tag=<tag-list>         : select a new tag-set" << endl;
2414  cout << "#   -tag_add=<tag-list>     : add specific comma-separated tag(s)" << endl;
2415  cout << "#   -tag_remove=<tag-list>  : remove specific comma-separated tag(s)" << endl;
2416  cout << "#   -warnings               : display various warnings" << endl;
2417  cout << "#   -with_version_directory : reset to default structuring style" << endl;
2418  cout << "#   -without_version_directory : switch structuring style" << endl;
2419  cout << "#   -cleanup                : activate install area cleanup" << endl;
2420  cout << "#   -no_cleanup             : inhibit install area cleanup" << endl;
2421  cout << "#   -xml                    : output in XML format (cmt setup, cmt show projects, cmt show uses)" << endl;
2422  cout << "#   -user_context=<path>    : set user context package/project directory" << endl;
2423  cout << "#   -home=<path>            : set home package/project directory" << endl;
2424}
2425
2426void CommandHelp::show (ActionType action)
2427{
2428  //  cerr << "CommandHelp::show> action = " << action << endl;
2429
2430  static HelpTexts& help_texts = get_help_texts ();
2431
2432  if (action == action_build)
2433    {
2434      const cmt_string& s = get_help_text (action);
2435      cout << "# " << s << endl;
2436      int i;
2437
2438      for (i = action_build_constituent_makefile; i <= action_build_windefs; i++)
2439        {
2440          const cmt_string& s = help_texts[i];
2441          cout << "#   " << s << endl;
2442        }
2443    }
2444  else if (action == action_check)
2445    {
2446      int i;
2447
2448      for (i = action_check_configuration; i <= action_check_version; i++)
2449        {
2450          const cmt_string& s = help_texts[i];
2451          cout << "#   " << s << endl;
2452        }
2453    }
2454  else if (action == action_show)
2455    {
2456      int i;
2457
2458      for (i = (action_show + 1); i <= action_show_versions; i++)
2459        {
2460          const cmt_string& s = help_texts[i];
2461          cout << "#   " << s << endl;
2462        }
2463    }
2464  else
2465    {
2466      const cmt_string& s = get_help_text (action);
2467      cout << "# " << s << endl;
2468    }
2469}
2470
2471CommandHelp& CommandHelp::instance ()
2472{
2473  static CommandHelp me;
2474  return (me);
2475}
2476
2477CommandHelp::CommandHelp ()
2478{
2479  static HelpMap& help = m_help;
2480
2481  static HelpTexts& help_texts = m_help_texts;
2482
2483  help_texts.clear ();
2484
2485  help_texts.add () =  "none";
2486  help_texts.add () =  "awk";
2487  help_texts.add () =  "broadcast [-select=list] [-exclude=list] [-local] [-global] [-begin=pattern] [-depth=n] <command> : apply a command to [some of] the used packages";
2488  help_texts.add () =  "build <argument>          : build actions. Try 'cmt help build'";
2489  //  help_texts.add () =  "build <option>          : build actions. (Try cmt help build)";
2490  help_texts.add () =  "build constituent_makefile [-out=<path>] [-with_cmt] [-without_cmt] <constituent> : generate constituent Makefile fragment";
2491  help_texts.add () =  "build constituent_config [-out=<path>] <constituent> : generate constituent Makefile fragment, also tag specific Makefile, and setup definitions file for constituent with associated tag (via -target_tag option, or action)";
2492  help_texts.add () =  "build constituents_makefile [-out=<path>] : generate constituents Makefile";
2493  help_texts.add () =  "build constituents_config [-out=<path>] [-with_cmt] [-without_cmt] : generate constituents Makefile, tag specific Makefile, and setup definitions file, also input requirements file for constituent(s) without associated tag";
2494  help_texts.add () =  "build broadcast_config [-out=<path>] : generate broadcast Makefile, and broadcast specific macros Makefile";
2495  help_texts.add () =  "build dependencies [-out=<path>] [-name=<constituent>] [-all_sources] [-no_stamps] [-I<directory>]... [-start_all FILE... -end_all] FILE... : generate dependencies for FILEs [of constituent <constituent>]";
2496  help_texts.add () =  "build library_links     : build symbolic links towards all imported libraries";
2497  help_texts.add () =  "build make_setup        : build a compiled version of setup scripts";
2498  help_texts.add () =  "build msdev             : generate MSDEV files";
2499  help_texts.add () =  "build CMT_pacman        : generate PACMAN manifest file for CMT";
2500  help_texts.add () =  "build vsnet             : generate VS.NET files";
2501  help_texts.add () =  "build os9_makefile      : generate Makefile for OS9";
2502  help_texts.add () =  "build prototype         : generate prototype file";
2503  help_texts.add () =  "build readme            : generate README.html";
2504  help_texts.add () =  "build tag_makefile      : generate tag specific Makefile";
2505  help_texts.add () =  "build temporary_name    : generate a name for a temprary file";
2506  help_texts.add () =  "build triggers <constituent> : generate library trigger file";
2507  help_texts.add () =  "build windefs [-name=NAME] [@commandfile] (objectfile|library)... : generate def file for Windows shared library [NAME]";
2508  help_texts.add () =  "check <option>          : check actions. (Try cmt help check)";
2509  help_texts.add () =  "check configuration     : check configuration";
2510  help_texts.add () =  "check files <old> <new> : compare two files and overrides <old> by <new> if different";
2511  help_texts.add () =  "check version <name>    : check if a name follows a version tag syntax ";
2512  help_texts.add () =  "co | checkout           : perform a cvs/svn checkout over a CMT package";
2513  help_texts.add () =  "cleanup [-csh|-sh|-bat] : generate a cleanup script";
2514  help_texts.add () =  "config                  : generate setup and cleanup scripts";
2515  help_texts.add () =  "create <package> <version> [<path>] : create and configure a new package";
2516  help_texts.add () =  "create_project <project> <name> [<path>] : create and configure a new project";
2517  help_texts.add () =  "cvsbranches <module>      : display the subdirectories for a module";
2518  help_texts.add () =  "cvssubpackages <module>   : display the subpackages for a module";
2519  help_texts.add () =  "cvssubprojects <module>   : display the subprojects for a module";
2520  help_texts.add () =  "cvstags <module>          : display the CVS tags for a module";
2521  help_texts.add () =  "do <action> [<param>=<value>] ... : Execute an action";
2522  help_texts.add () =  "expand model <model>    : ";
2523  help_texts.add () =  "filter <in> <out>       : filter a file against CMT macros and env. variables";
2524  help_texts.add () =  "help | -help | --help   : display this help";
2525  help_texts.add () =  "load";
2526  help_texts.add () =  "lock [<p> <v> [<path>]] : lock a package";
2527  help_texts.add () =  "relocate                : generate only setup scripts";
2528  help_texts.add () =  "remove <package> <version> [<path>] : remove a package version";
2529  help_texts.add () =  "remove library_links    : remove symbolic links towards all imported libraries";
2530  help_texts.add () =  "run '<command>'         : apply a command";
2531  help_texts.add () =  "run_sequence <sequence file> : execute a cmt equence file";
2532  help_texts.add () =  "set version <version>   : generate a version file in the current package";
2533  help_texts.add () =  "set versions            : generate version files into packages";
2534  help_texts.add () =  "setup [-csh|-sh|-bat|-cmt|-requirements] : generate a setup script (or standalone requirements file from which generate the setup script)";
2535  help_texts.add () =  "show <option>           : query actions. (Try cmt help show)";
2536  help_texts.add () =  "show  action <name>     :  a formatted action definition";
2537  help_texts.add () =  "show  action_value <name> :  a raw action definition";
2538  help_texts.add () =  "show  action_names [<regexp>] :  all action names [matching <regexp>]";
2539  help_texts.add () =  "show  actions [<regexp>] :  all action definitions [for names matching <regexp>]";
2540  help_texts.add () =  "show  alias <name>      :  a formatted alias definition";
2541  help_texts.add () =  "show  alias_value <name> :  a raw alias definition";
2542  help_texts.add () =  "show  alias_names [<regexp>] :  all alias names [matching <regexp>]";
2543  help_texts.add () =  "show  aliases [<regexp>] :  all alias definitions [for names matching <regexp>]";
2544  help_texts.add () =  "show  all_tags          :  all defined tags";
2545  help_texts.add () =  "show  applied_patterns  :  all patterns actually applied";
2546  help_texts.add () =  "show  author            :  package author";
2547  help_texts.add () =  "show  branches          :  added branches";
2548  help_texts.add () =  "show  clients <package> [<version> [<path>]] :  clients of <package> [of <version> [in <path>]]";
2549  help_texts.add () =  "show  cmtpath_patterns  :  cmtpath_patterns";
2550  help_texts.add () =  "show  constituent <name>:  constituent definition";
2551  help_texts.add () =  "show  constituent_names :  constituent names";
2552  help_texts.add () =  "show  constituents      :  constituent definitions";
2553  help_texts.add () =  "show  container [<path>]... :  container package of current project [or <path>s projects]";
2554  help_texts.add () =  "show  cycles            :  cycles in the use graph";
2555  help_texts.add () =  "show  fragment <name>   :  one fragment definition";
2556  help_texts.add () =  "show  fragments         :  fragment definitions";
2557  help_texts.add () =  "show  groups            :  group definitions";
2558  help_texts.add () =  "show  include_dirs      :  ";
2559  help_texts.add () =  "show  language <name>   :  language definition";
2560  help_texts.add () =  "show  languages         :  language definitions";
2561  help_texts.add () =  "show  macro <name>      :  a formatted macro definition";
2562  help_texts.add () =  "show  macro_value <name>  :  a raw macro definition";
2563  help_texts.add () =  "show  macro_names [<regexp>] :  all macro names [matching <regexp>]";
2564  help_texts.add () =  "show  macros [<regexp>] :  all macro definitions [for names matching <regexp>]";
2565  help_texts.add () =  "show  manager           :  package manager";
2566  help_texts.add () =  "show  packages [<path>]... :  packages reachable from the current context [or <path>s]";
2567  help_texts.add () =  "show  path [-d]         :  the package search paths list [in detail]";
2568  help_texts.add () =  "show  pattern <name>    :  the pattern definition and usages";
2569  help_texts.add () =  "show  pattern_names     :  pattern names";
2570  help_texts.add () =  "show  patterns          :  the pattern definitions";
2571  help_texts.add () =  "show  projects          :  project definitions";
2572  help_texts.add () =  "show  project author    :  project author";
2573  help_texts.add () =  "show  setup             :  setup definitions";
2574  help_texts.add () =  "show  pwd               :  filtered current directory";
2575  help_texts.add () =  "show  set <name>        :  a formatted set definition";
2576  help_texts.add () =  "show  set_names [<regexp>] :  set names [matching <regexp>]";
2577  help_texts.add () =  "show  set_value <name>  :  a raw set definition";
2578  help_texts.add () =  "show  sets [<regexp>]   :  set definitions [for names matching <regexp>]";
2579  help_texts.add () =  "show  strategies        :  all strategies (build & version)";
2580  help_texts.add () =  "show  tags              :  all currently active tags";
2581  help_texts.add () =  "show  use_paths <package> :  all use paths to the used <package>";
2582  help_texts.add () =  "show  uses              :  used packages";
2583  help_texts.add () =  "show  version           :  version of the current package";
2584  help_texts.add () =  "show  versions <package> :  visible versions of the selected <package>";
2585  help_texts.add () =  "system                  : display the system tag";
2586  help_texts.add () =  "unlock [<p> <v> [<path>]] : unlock a package";
2587  help_texts.add () =  "version                 : version of CMT";
2588  help_texts.add () =  "";
2589
2590  //"build <key>             : build various components :"
2591  //"show <key>              : display various infos on :"
2592
2593  help.add (action_none, help_texts[action_none]);
2594  help.add (action_awk, help_texts[action_awk]);
2595  help.add (action_broadcast, help_texts[action_broadcast]);
2596  help.add (action_build, help_texts[action_build]);
2597  help.add (action_build_constituent_makefile, help_texts[action_build_constituent_makefile]);
2598  help.add (action_build_constituent_config, help_texts[action_build_constituent_config]);
2599  help.add (action_build_constituents_makefile, help_texts[action_build_constituents_makefile]);
2600  help.add (action_build_constituents_config, help_texts[action_build_constituents_config]);
2601  help.add (action_build_broadcast_config, help_texts[action_build_broadcast_config]);
2602  help.add (action_build_dependencies, help_texts[action_build_dependencies]);
2603  help.add (action_build_library_links, help_texts[action_build_library_links]);
2604  help.add (action_build_make_setup, help_texts[action_build_make_setup]);
2605  help.add (action_build_msdev, help_texts[action_build_msdev]);
2606  help.add (action_build_CMT_pacman, help_texts[action_build_CMT_pacman]);
2607  help.add (action_build_vsnet, help_texts[action_build_vsnet]);
2608  help.add (action_build_os9_makefile, help_texts[action_build_os9_makefile]);
2609  help.add (action_build_prototype, help_texts[action_build_prototype]);
2610  help.add (action_build_readme, help_texts[action_build_readme]);
2611  help.add (action_build_tag_makefile, help_texts[action_build_tag_makefile]);
2612  help.add (action_build_temporary_name, help_texts[action_build_temporary_name]);
2613  help.add (action_build_triggers, help_texts[action_build_triggers]);
2614  help.add (action_build_windefs, help_texts[action_build_windefs]);
2615  help.add (action_check_configuration, help_texts[action_check_configuration]);
2616  help.add (action_check_files, help_texts[action_check_files]);
2617  help.add (action_check_version, help_texts[action_check_version]);
2618  help.add (action_checkout, help_texts[action_checkout]);
2619  help.add (action_cleanup, help_texts[action_cleanup]);
2620  help.add (action_config, help_texts[action_config]);
2621  help.add (action_create, help_texts[action_create]);
2622  help.add (action_create_project, help_texts[action_create_project]);
2623  help.add (action_cvsbranches, help_texts[action_cvsbranches]);
2624  help.add (action_cvssubpackages, help_texts[action_cvssubpackages]);
2625  help.add (action_cvssubprojects, help_texts[action_cvssubprojects]);
2626  help.add (action_cvstags, help_texts[action_cvstags]);
2627  help.add (action_do, help_texts[action_do]);
2628  help.add (action_expand_model, help_texts[action_expand_model]);
2629  help.add (action_filter, help_texts[action_filter]);
2630  help.add (action_help, help_texts[action_help]);
2631  help.add (action_load, help_texts[action_load]);
2632  help.add (action_lock, help_texts[action_lock]);
2633  help.add (action_relocate, help_texts[action_relocate]);
2634  help.add (action_remove, help_texts[action_remove]);
2635  help.add (action_remove_library_links, help_texts[action_remove_library_links]);
2636  help.add (action_run, help_texts[action_run]);
2637  help.add (action_run_sequence, help_texts[action_run_sequence]);
2638  help.add (action_set_version, help_texts[action_set_version]);
2639  help.add (action_set_versions, help_texts[action_set_versions]);
2640  help.add (action_setup, help_texts[action_setup]);
2641  help.add (action_show, help_texts[action_show]);
2642  help.add (action_show_action, help_texts[action_show_action]);
2643  help.add (action_show_action_value, help_texts[action_show_action_value]);
2644  help.add (action_show_action_names, help_texts[action_show_action_names]);
2645  help.add (action_show_actions, help_texts[action_show_actions]);
2646  help.add (action_show_alias, help_texts[action_show_alias]);
2647  help.add (action_show_alias_value, help_texts[action_show_alias_value]);
2648  help.add (action_show_alias_names, help_texts[action_show_alias_names]);
2649  help.add (action_show_aliases, help_texts[action_show_aliases]);
2650  help.add (action_show_all_tags, help_texts[action_show_all_tags]);
2651  help.add (action_show_applied_patterns, help_texts[action_show_applied_patterns]);
2652  help.add (action_show_author, help_texts[action_show_author]);
2653  help.add (action_show_branches, help_texts[action_show_branches]);
2654  help.add (action_show_clients, help_texts[action_show_clients]);
2655  help.add (action_show_cmtpath_patterns, help_texts[action_show_cmtpath_patterns]);
2656  help.add (action_show_constituent, help_texts[action_show_constituent]);
2657  help.add (action_show_constituent_names, help_texts[action_show_constituent_names]);
2658  help.add (action_show_constituents, help_texts[action_show_constituents]);
2659  help.add (action_show_container, help_texts[action_show_container]);
2660  help.add (action_show_cycles, help_texts[action_show_cycles]);
2661  help.add (action_show_fragment, help_texts[action_show_fragment]);
2662  help.add (action_show_fragments, help_texts[action_show_fragments]);
2663  help.add (action_show_groups, help_texts[action_show_groups]);
2664  help.add (action_show_include_dirs, help_texts[action_show_include_dirs]);
2665  help.add (action_show_language, help_texts[action_show_language]);
2666  help.add (action_show_languages, help_texts[action_show_languages]);
2667  help.add (action_show_macro, help_texts[action_show_macro]);
2668  help.add (action_show_macro_value, help_texts[action_show_macro_value]);
2669  help.add (action_show_macro_names, help_texts[action_show_macro_names]);
2670  help.add (action_show_macros, help_texts[action_show_macros]);
2671  help.add (action_show_manager, help_texts[action_show_manager]);
2672  help.add (action_show_packages, help_texts[action_show_packages]);
2673  help.add (action_show_path, help_texts[action_show_path]);
2674  help.add (action_show_pattern, help_texts[action_show_pattern]);
2675  help.add (action_show_pattern_names, help_texts[action_show_pattern_names]);
2676  help.add (action_show_patterns, help_texts[action_show_patterns]);
2677  help.add (action_show_projects, help_texts[action_show_projects]);
2678  help.add (action_show_project_author, help_texts[action_show_project_author]);
2679  help.add (action_show_setup, help_texts[action_show_setup]);
2680  help.add (action_show_pwd, help_texts[action_show_pwd]);
2681  help.add (action_show_set, help_texts[action_show_set]);
2682  help.add (action_show_set_names, help_texts[action_show_set_names]);
2683  help.add (action_show_set_value, help_texts[action_show_set_value]);
2684  help.add (action_show_sets, help_texts[action_show_sets]);
2685  help.add (action_show_strategies, help_texts[action_show_strategies]);
2686  help.add (action_show_tags, help_texts[action_show_tags]);
2687  help.add (action_show_use_paths, help_texts[action_show_use_paths]);
2688  help.add (action_show_uses, help_texts[action_show_uses]);
2689  help.add (action_show_version, help_texts[action_show_version]);
2690  help.add (action_show_versions, help_texts[action_show_versions]);
2691  help.add (action_system, help_texts[action_system]);
2692  help.add (action_unlock, help_texts[action_unlock]);
2693  help.add (action_version, help_texts[action_version]);
2694}
2695
Note: See TracBrowser for help on using the repository browser.