source: CMT/v1r25p20130606/source/cmt_commands.cxx

Last change on this file was 612, checked in by rybkin, 12 years ago

See C.L. 487

  • Property svn:eol-style set to native
File size: 71.7 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}
1908
1909void ArgParser::option_quiet ()
1910{
1911  cmt.m_quiet = true;
1912  if (CmtMessage::level () <= Error)
1913    CmtMessage::set_level (Fatal);
1914}
1915
1916
1917void ArgParser::option_warnings ()
1918{
1919  cmt.m_warnings = true;
1920  if (CmtMessage::level () != Warning)
1921    CmtMessage::set_level (Warning);
1922}
1923
1924void ArgParser::option_csh ()
1925{
1926  mode = Csh;
1927}
1928
1929void ArgParser::option_sh ()
1930{
1931  mode = Sh;
1932}
1933
1934void ArgParser::option_bat ()
1935{
1936  mode = Bat;
1937}
1938
1939void ArgParser::option_requirements ()
1940{
1941  mode = Requirements;
1942}
1943
1944void ArgParser::option_xml ()
1945{
1946  mode = Xml;
1947}
1948
1949void ArgParser::option_use ()
1950{
1951  if (cmt.m_action != action_create)
1952    {
1953      CmtSystem::cmt_string_vector words;
1954
1955      CmtSystem::split (arg, ":", words);
1956
1957      cmt.m_current_access = UserMode;
1958
1959      if (words.size () > 0) cmt.m_current_package = words[0];
1960      if (words.size () > 1) cmt.m_current_version = words[1];
1961      if (words.size () > 2) cmt.m_current_path    = words[2];
1962      (Use::current()).set (cmt.m_current_package, 
1963                            cmt.m_current_version, 
1964                            cmt.m_current_path);
1965
1966      Use& use = Use::current();
1967      if (use.get_package_name () == "cmt_standalone")
1968        {
1969          if (!CmtSystem::cd (use.path) || !CmtSystem::test_file ("requirements"))
1970            {
1971              CmtError::set (CmtError::package_not_found, use.get_info ());
1972              return;
1973            }
1974          use.style = none_style;
1975          use.structuring_style = without_version_directory;
1976          use.change_path (CmtSystem::pwd ());
1977        }
1978      else if (!use.move_to ("", true))
1979        {
1980          CmtError::set (CmtError::package_not_found, use.get_info ());
1981          return;
1982        }
1983      Project::order_all ();
1984      Cmt::guess_current_project ();
1985    }
1986}
1987
1988void ArgParser::option_pack ()
1989{
1990  if ((cmt.m_action != action_create) && (cmt.m_current_package != arg))
1991    {
1992      //CmtSystem::cd (cmt.m_default_path);
1993
1994      cmt.m_current_access = UserMode;
1995
1996      cmt.m_current_package = arg;
1997      cmt.m_current_version = "";
1998
1999      /*
2000      cerr << "ArgParser::option_pack> "
2001           << " cp=" << cmt.m_current_package
2002           << " cv=" << cmt.m_current_version
2003           << " cp=" << cmt.m_current_path << endl;
2004      */
2005
2006      (Use::current()).set (cmt.m_current_package, 
2007                            cmt.m_current_version, 
2008                            cmt.m_current_path);
2009    }
2010}
2011
2012void ArgParser::option_version ()
2013{
2014  if ((cmt.m_action != action_create) && (cmt.m_current_version != arg))
2015    {
2016      cmt.m_current_access = UserMode;
2017      cmt.m_current_version = arg;
2018
2019      /*
2020      cerr << "ArgParser::option_version> "
2021           << " cp=" << cmt.m_current_package
2022           << " cv=" << cmt.m_current_version
2023           << " cp=" << cmt.m_current_path << endl;
2024      */
2025
2026      (Use::current()).set (cmt.m_current_package, 
2027                            cmt.m_current_version, 
2028                            cmt.m_current_path);
2029    }
2030}
2031
2032void ArgParser::option_path ()
2033{
2034  if ((cmt.m_action != action_create) && (cmt.m_current_path != arg))
2035    {
2036      cmt.m_current_access = UserMode;
2037      cmt.m_current_path = arg;
2038
2039      /*
2040      cerr << "ArgParser::option_path> "
2041           << " cp=" << cmt.m_current_package
2042           << " cv=" << cmt.m_current_version
2043           << " cp=" << cmt.m_current_path << endl;
2044      */
2045
2046      (Use::current()).set (cmt.m_current_package, 
2047                            cmt.m_current_version, 
2048                            cmt.m_current_path);
2049
2050      //IProjectFactory& factory = ProjectFactory::instance ();
2051      //CmtSystem::add_cmt_path (cmt.m_current_path, "argument", factory);
2052      Use& use = Use::current();
2053      if (use.get_package_name () == "cmt_standalone")
2054        {
2055          if (!CmtSystem::cd (use.path) || !CmtSystem::test_file ("requirements"))
2056            {
2057              CmtError::set (CmtError::package_not_found, use.get_info ());
2058              return;
2059            }
2060          use.style = none_style;
2061          use.structuring_style = without_version_directory;
2062          use.change_path (CmtSystem::pwd ());
2063        }
2064      else if (!use.move_to ("", true))
2065        {
2066          CmtError::set (CmtError::package_not_found, use.get_info ());
2067          return;
2068        }
2069      Project::order_all ();
2070      Cmt::guess_current_project ();
2071    }
2072}
2073
2074void ArgParser::option_f ()
2075{
2076  extra_file = arg;
2077}
2078
2079void ArgParser::option_e ()
2080{
2081  //CmtMessage::warning ("extra statement = " + arg);
2082  extra_line = arg;
2083}
2084
2085void ArgParser::option_home ()
2086{
2087  if (CmtSystem::test_directory (arg))
2088    {
2089      cmt.m_cmt_home = arg;
2090    }
2091}
2092
2093void ArgParser::option_tag ()
2094{
2095  /*
2096    Here we are going to change the complete tag set
2097  */
2098  if (arg != "")
2099    {
2100      Tag* tag;
2101      CmtSystem::cmt_string_vector words;
2102
2103      // First reset selection of all existing tags
2104      //Tag::clear_all ();
2105      Tag::unmark_all ();
2106      cmt.m_extra_tags = ",";
2107                   
2108      // Then restore CMTSITE
2109      Cmt::configure_version_tag ();
2110      Cmt::configure_site_tag (0);
2111      Cmt::configure_uname_tag ();
2112      Cmt::configure_hosttype_tag ();
2113      Cmt::configure_config_tag ();
2114      Cmt::configure_home (0);
2115      Cmt::guess_current_project ();
2116
2117      CmtSystem::split (arg, " \t,", words);
2118                 
2119      for (int i = 0; i < words.size (); i++)
2120        {
2121          const cmt_string& a = words[i];
2122      //if (!cmt.m_quiet) cout  << "parse_argument(tag_add)> current_tag=" << a << endl;                     
2123          cmt_string s = ",";
2124          s += a;
2125          s += ",";
2126                     
2127          if (i == 0)
2128            {
2129              cmt.m_current_tag = a;
2130                         
2131              if (CmtSystem::testenv ("TAGDEBUG")) 
2132              cerr << "parse_argument(tag_add)> current_tag=" << cmt.m_current_tag << endl;
2133            }
2134                     
2135          if (cmt.m_extra_tags.find (s) == cmt_string::npos)
2136            {
2137              //if (!cmt.m_quiet) cerr << "  a=[" << a << "]" << endl;
2138                         
2139              // Then restore uname if the specified tag is CMTCONFIG
2140              if (a == CmtSystem::get_cmt_config ())
2141                {
2142                  Cmt::configure_uname_tag ();
2143                }
2144                         
2145              tag = Tag::add (a, PriorityArgument, "arguments", 0);
2146              tag->mark ("arguments");
2147              cmt.m_extra_tags += a;
2148              cmt.m_extra_tags += ",";
2149            }
2150        }
2151        // To be sure that a tag
2152        Cmt::guess_current_project ();
2153    }
2154}
2155
2156void ArgParser::option_tag_add ()
2157{
2158  Tag* tag;
2159  CmtSystem::cmt_string_vector words;
2160 
2161
2162  CmtSystem::split (arg, " \t,", words);
2163
2164  for (int i = 0; i < words.size (); i++)
2165    {
2166      const cmt_string& a = words[i];
2167
2168      cmt_string s = ",";
2169      s += a;
2170      s += ",";
2171
2172      if (cmt.m_extra_tags.find (s) == cmt_string::npos)
2173        {
2174          //if (!cmt.m_quiet) cerr << "  a=[" << a << "]" << endl;
2175
2176          /// Then restore uname if the specified tag is CMTCONFIG
2177          if (a == CmtSystem::get_cmt_config ())
2178            {
2179              Cmt::configure_uname_tag ();
2180            }
2181                     
2182          tag = Tag::add (a, PriorityUserTag, "arguments", 0);
2183                     
2184          tag->mark ("arguments");
2185
2186          cmt.m_extra_tags += a;
2187          cmt.m_extra_tags += ",";
2188        }
2189    }
2190}
2191
2192void ArgParser::option_tag_remove ()
2193{
2194  Tag::TagPtrVector tags = Tag::tags ();
2195  int i;
2196  Tag* tag;
2197
2198  /*
2199    for (i = 0; i < tags.size (); i++)
2200    {
2201    tag = tags[i];
2202    if ((tag != 0) &&
2203    (tag->selected))
2204    {
2205    if (!cmt.m_quiet) cerr << "  original tag_list=" << tag->name << tag->priority << endl;
2206    }
2207    }
2208  */
2209
2210  CmtSystem::cmt_string_vector words;
2211
2212  //if (!cmt.m_quiet) cerr << "-arg_remove=" << arg << endl;
2213
2214  CmtSystem::split (arg, " \t,", words);
2215
2216  //
2217  // Now erase all entries in the old list that match
2218  // the specified tags
2219  //
2220
2221  for (i = 0; i < words.size (); i++)
2222    {
2223      const cmt_string& a = words[i];
2224
2225      cmt_string s = ",";
2226      s += a;
2227      s += ",";
2228
2229      int pos;
2230
2231      pos = cmt.m_extra_tags.find (s);
2232
2233      if (pos != cmt_string::npos)
2234        {
2235          cmt.m_extra_tags.erase (pos, s.size () - 1);
2236        }
2237
2238      //if (!cmt.m_quiet) cerr << "  tag_list=[" << tag_list << "]" << endl;
2239    }
2240
2241  //
2242  // Now reinject the purged list of tags into the database
2243  // exactly as when using -tag=<tag-list>
2244  //
2245
2246  /// First forget about all existing tags
2247      Tag::unmark_all ();
2248
2249      /// Then restore CMTSITE
2250        Cmt::configure_version_tag ();
2251        Cmt::configure_site_tag (0);
2252        Cmt::configure_uname_tag ();
2253        Cmt::configure_hosttype_tag ();
2254             
2255        CmtSystem::split (cmt.m_extra_tags, " \t,", words);
2256
2257        for (i = 0; i < words.size (); i++)
2258          {
2259            const cmt_string& a = words[i];
2260
2261            //fprintf (stderr, "  a=[%s]\n", a.c_str ());
2262
2263            /// Then restore uname if the specified tag is CMTCONFIG
2264              if (a == CmtSystem::get_cmt_config ())
2265                {
2266                  Cmt::configure_uname_tag ();
2267                }
2268
2269              if (i == 0)
2270                {
2271                  cmt.m_current_tag = a;
2272
2273                  //if (!cmt.m_quiet) cerr << "parse_argument(tag_remove)> current_tag="
2274                  //<< cmt.m_current_tag << endl;
2275
2276                  tag = Tag::add (a, PriorityTag, "arguments", 0);
2277                }
2278              else
2279                {
2280                  tag = Tag::add (a, PriorityUserTag, "arguments", 0);
2281                }
2282
2283              tag->mark ("arguments");
2284          }
2285}
2286
2287void ArgParser::option_user_context ()
2288{
2289  if (CmtSystem::test_directory (arg))
2290    {
2291      cmt.m_cmt_user_context = arg;
2292    }
2293}
2294
2295void ArgParser::option_with_cmt ()
2296{
2297  cmt.m_use_cmt = true;
2298  if (!Cmt::add_cmt_flag ("-with_cmt"))
2299    CmtMessage::error ("Cannot add flag `-with_cmt'");
2300}
2301
2302void ArgParser::option_without_cmt ()
2303{
2304  cmt.m_use_cmt = false;
2305  if (!Cmt::add_cmt_flag ("-without_cmt"))
2306    CmtMessage::error ("Cannot add flag `-without_cmt'");
2307}
2308
2309void ArgParser::option_with_version_directory ()
2310{
2311  cmt.m_current_structuring_style = with_version_directory;
2312
2313  StrategyDef* def = StrategyMgr::find_strategy ("VersionDirectory");
2314  if (def != 0)
2315    {
2316      def->m_default_value = true;
2317      def->m_priority_value = false;
2318    }
2319}
2320
2321void ArgParser::option_without_version_directory ()
2322{
2323  cmt.m_current_structuring_style = without_version_directory;
2324
2325  StrategyDef* def = StrategyMgr::find_strategy ("VersionDirectory");
2326  if (def != 0)
2327    {
2328      def->m_default_value = false;
2329      def->m_priority_value = true;
2330    }
2331}
2332
2333void ArgParser::option_no_cleanup ()
2334{
2335  //cmt.m_current_setup_strategy |= SetupNoCleanup;
2336}
2337
2338void ArgParser::option_private ()
2339{
2340  cmt.m_scope_filtering_mode = reach_private_uses;
2341}
2342
2343void ArgParser::option_public ()
2344{
2345  cmt.m_scope_filtering_mode = block_private_uses;
2346}
2347
2348
2349
2350
2351
2352
2353CommandHelp::HelpMap& CommandHelp::get_help ()
2354{
2355  static CommandHelp& me = instance ();
2356
2357  return (me.m_help);
2358}
2359
2360CommandHelp::HelpTexts& CommandHelp::get_help_texts ()
2361{
2362  static CommandHelp& me = instance ();
2363
2364  return (me.m_help_texts);
2365}
2366
2367const cmt_string& CommandHelp::get_help_text (ActionType key)
2368{
2369  static const HelpTexts& help = get_help_texts ();
2370
2371  const cmt_string& h = help[key];
2372  return (h);
2373}
2374
2375void CommandHelp::show_all ()
2376{
2377  static HelpTexts& help_texts = get_help_texts ();
2378
2379  cout << "#> cmt command [option...]" << endl;
2380  cout << "# command :" << endl;
2381
2382  int i;
2383
2384  for (i = 0; ; i++)
2385    {
2386      const cmt_string& s = help_texts[i];
2387      if (s == "") break;
2388      cout << "#   " << s << endl;
2389    }
2390
2391  cout << "# global options :" << endl;
2392
2393  cout << "#   -disable_warnings       : don't print warnings" << endl;
2394  cout << "#   -quiet                  : don't print errors" << endl;
2395  cout << "#   -use=<p>:<v>:<path>     : set package version path" << endl;
2396  cout << "#   -pack=<package>         : set package" << endl;
2397  cout << "#   -version=<version>      : set version" << endl;
2398  cout << "#   -path=<path>            : set root path" << endl;
2399  cout << "#   -f=<requirements-file>  : set input file" << endl;
2400  cout << "#   -e=<statement>          : add a one line statement" << endl;
2401  cout << "#   -tag=<tag-list>         : select a new tag-set" << endl;
2402  cout << "#   -tag_add=<tag-list>     : add specific comma-separated tag(s)" << endl;
2403  cout << "#   -tag_remove=<tag-list>  : remove specific comma-separated tag(s)" << endl;
2404  cout << "#   -warnings               : display various warnings" << endl;
2405  cout << "#   -with_version_directory : reset to default structuring style" << endl;
2406  cout << "#   -without_version_directory : switch structuring style" << endl;
2407  cout << "#   -cleanup                : activate install area cleanup" << endl;
2408  cout << "#   -no_cleanup             : inhibit install area cleanup" << endl;
2409  cout << "#   -xml                    : output in XML format (cmt setup, cmt show projects, cmt show uses)" << endl;
2410}
2411
2412void CommandHelp::show (ActionType action)
2413{
2414  //  cerr << "CommandHelp::show> action = " << action << endl;
2415
2416  static HelpTexts& help_texts = get_help_texts ();
2417
2418  if (action == action_build)
2419    {
2420      const cmt_string& s = get_help_text (action);
2421      cout << "# " << s << endl;
2422      int i;
2423
2424      for (i = action_build_constituent_makefile; i <= action_build_windefs; i++)
2425        {
2426          const cmt_string& s = help_texts[i];
2427          cout << "#   " << s << endl;
2428        }
2429    }
2430  else if (action == action_check)
2431    {
2432      int i;
2433
2434      for (i = action_check_configuration; i <= action_check_version; i++)
2435        {
2436          const cmt_string& s = help_texts[i];
2437          cout << "#   " << s << endl;
2438        }
2439    }
2440  else if (action == action_show)
2441    {
2442      int i;
2443
2444      for (i = (action_show + 1); i <= action_show_versions; i++)
2445        {
2446          const cmt_string& s = help_texts[i];
2447          cout << "#   " << s << endl;
2448        }
2449    }
2450  else
2451    {
2452      const cmt_string& s = get_help_text (action);
2453      cout << "# " << s << endl;
2454    }
2455}
2456
2457CommandHelp& CommandHelp::instance ()
2458{
2459  static CommandHelp me;
2460  return (me);
2461}
2462
2463CommandHelp::CommandHelp ()
2464{
2465  static HelpMap& help = m_help;
2466
2467  static HelpTexts& help_texts = m_help_texts;
2468
2469  help_texts.clear ();
2470
2471  help_texts.add () =  "none";
2472  help_texts.add () =  "awk";
2473  help_texts.add () =  "broadcast [-select=list] [-exclude=list] [-local] [-global] [-begin=pattern] [-depth=n] <command> : apply a command to [some of] the used packages";
2474  help_texts.add () =  "build <argument>          : build actions. Try 'cmt help build'";
2475  //  help_texts.add () =  "build <option>          : build actions. (Try cmt help build)";
2476  help_texts.add () =  "build constituent_makefile [-out=<path>] [-with_cmt] [-without_cmt] <constituent> : generate constituent Makefile fragment";
2477  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)";
2478  help_texts.add () =  "build constituents_makefile [-out=<path>] : generate constituents Makefile";
2479  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";
2480  help_texts.add () =  "build broadcast_config [-out=<path>] : generate broadcast Makefile, and broadcast specific macros Makefile";
2481  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>]";
2482  help_texts.add () =  "build library_links     : build symbolic links towards all imported libraries";
2483  help_texts.add () =  "build make_setup        : build a compiled version of setup scripts";
2484  help_texts.add () =  "build msdev             : generate MSDEV files";
2485  help_texts.add () =  "build CMT_pacman        : generate PACMAN manifest file for CMT";
2486  help_texts.add () =  "build vsnet             : generate VS.NET files";
2487  help_texts.add () =  "build os9_makefile      : generate Makefile for OS9";
2488  help_texts.add () =  "build prototype         : generate prototype file";
2489  help_texts.add () =  "build readme            : generate README.html";
2490  help_texts.add () =  "build tag_makefile      : generate tag specific Makefile";
2491  help_texts.add () =  "build temporary_name    : generate a name for a temprary file";
2492  help_texts.add () =  "build triggers <constituent> : generate library trigger file";
2493  help_texts.add () =  "build windefs [-name=NAME] [@commandfile] (objectfile|library)... : generate def file for Windows shared library [NAME]";
2494  help_texts.add () =  "check <option>          : check actions. (Try cmt help check)";
2495  help_texts.add () =  "check configuration     : check configuration";
2496  help_texts.add () =  "check files <old> <new> : compare two files and overrides <old> by <new> if different";
2497  help_texts.add () =  "check version <name>    : check if a name follows a version tag syntax ";
2498  help_texts.add () =  "co | checkout           : perform a cvs/svn checkout over a CMT package";
2499  help_texts.add () =  "cleanup [-csh|-sh|-bat] : generate a cleanup script";
2500  help_texts.add () =  "config                  : generate setup and cleanup scripts";
2501  help_texts.add () =  "create <package> <version> [<path>] : create and configure a new package";
2502  help_texts.add () =  "create_project <project> <name> [<path>] : create and configure a new project";
2503  help_texts.add () =  "cvsbranches <module>      : display the subdirectories for a module";
2504  help_texts.add () =  "cvssubpackages <module>   : display the subpackages for a module";
2505  help_texts.add () =  "cvssubprojects <module>   : display the subprojects for a module";
2506  help_texts.add () =  "cvstags <module>          : display the CVS tags for a module";
2507  help_texts.add () =  "do <action> [<param>=<value>] ... : Execute an action";
2508  help_texts.add () =  "expand model <model>    : ";
2509  help_texts.add () =  "filter <in> <out>       : filter a file against CMT macros and env. variables";
2510  help_texts.add () =  "help | -help | --help   : display this help";
2511  help_texts.add () =  "load";
2512  help_texts.add () =  "lock [<p> <v> [<path>]] : lock a package";
2513  help_texts.add () =  "relocate                : generate only setup scripts";
2514  help_texts.add () =  "remove <package> <version> [<path>] : remove a package version";
2515  help_texts.add () =  "remove library_links    : remove symbolic links towards all imported libraries";
2516  help_texts.add () =  "run '<command>'         : apply a command";
2517  help_texts.add () =  "run_sequence <sequence file> : execute a cmt equence file";
2518  help_texts.add () =  "set version <version>   : generate a version file in the current package";
2519  help_texts.add () =  "set versions            : generate version files into packages";
2520  help_texts.add () =  "setup [-csh|-sh|-bat|-cmt|-requirements] : generate a setup script (or standalone requirements file from which generate the setup script)";
2521  help_texts.add () =  "show <option>           : query actions. (Try cmt help show)";
2522  help_texts.add () =  "show  action <name>     :  a formatted action definition";
2523  help_texts.add () =  "show  action_value <name> :  a raw action definition";
2524  help_texts.add () =  "show  action_names [<regexp>] :  all action names [matching <regexp>]";
2525  help_texts.add () =  "show  actions [<regexp>] :  all action definitions [for names matching <regexp>]";
2526  help_texts.add () =  "show  alias <name>      :  a formatted alias definition";
2527  help_texts.add () =  "show  alias_value <name> :  a raw alias definition";
2528  help_texts.add () =  "show  alias_names [<regexp>] :  all alias names [matching <regexp>]";
2529  help_texts.add () =  "show  aliases [<regexp>] :  all alias definitions [for names matching <regexp>]";
2530  help_texts.add () =  "show  all_tags          :  all defined tags";
2531  help_texts.add () =  "show  applied_patterns  :  all patterns actually applied";
2532  help_texts.add () =  "show  author            :  package author";
2533  help_texts.add () =  "show  branches          :  added branches";
2534  help_texts.add () =  "show  clients <package> [<version> [<path>]] :  clients of <package> [of <version> [in <path>]]";
2535  help_texts.add () =  "show  cmtpath_patterns  :  cmtpath_patterns";
2536  help_texts.add () =  "show  constituent <name>:  constituent definition";
2537  help_texts.add () =  "show  constituent_names :  constituent names";
2538  help_texts.add () =  "show  constituents      :  constituent definitions";
2539  help_texts.add () =  "show  container [<path>]... :  container package of current project [or <path>s projects]";
2540  help_texts.add () =  "show  cycles            :  cycles in the use graph";
2541  help_texts.add () =  "show  fragment <name>   :  one fragment definition";
2542  help_texts.add () =  "show  fragments         :  fragment definitions";
2543  help_texts.add () =  "show  groups            :  group definitions";
2544  help_texts.add () =  "show  include_dirs      :  ";
2545  help_texts.add () =  "show  language <name>   :  language definition";
2546  help_texts.add () =  "show  languages         :  language definitions";
2547  help_texts.add () =  "show  macro <name>      :  a formatted macro definition";
2548  help_texts.add () =  "show  macro_value <name>  :  a raw macro definition";
2549  help_texts.add () =  "show  macro_names [<regexp>] :  all macro names [matching <regexp>]";
2550  help_texts.add () =  "show  macros [<regexp>] :  all macro definitions [for names matching <regexp>]";
2551  help_texts.add () =  "show  manager           :  package manager";
2552  help_texts.add () =  "show  packages [<path>]... :  packages reachable from the current context [or <path>s]";
2553  help_texts.add () =  "show  path [-d]         :  the package search paths list [in detail]";
2554  help_texts.add () =  "show  pattern <name>    :  the pattern definition and usages";
2555  help_texts.add () =  "show  pattern_names     :  pattern names";
2556  help_texts.add () =  "show  patterns          :  the pattern definitions";
2557  help_texts.add () =  "show  projects          :  project definitions";
2558  help_texts.add () =  "show  project author    :  project author";
2559  help_texts.add () =  "show  setup             :  setup definitions";
2560  help_texts.add () =  "show  pwd               :  filtered current directory";
2561  help_texts.add () =  "show  set <name>        :  a formatted set definition";
2562  help_texts.add () =  "show  set_names [<regexp>] :  set names [matching <regexp>]";
2563  help_texts.add () =  "show  set_value <name>  :  a raw set definition";
2564  help_texts.add () =  "show  sets [<regexp>]   :  set definitions [for names matching <regexp>]";
2565  help_texts.add () =  "show  strategies        :  all strategies (build & version)";
2566  help_texts.add () =  "show  tags              :  all currently active tags";
2567  help_texts.add () =  "show  use_paths <package> :  all use paths to the used <package>";
2568  help_texts.add () =  "show  uses              :  used packages";
2569  help_texts.add () =  "show  version           :  version of the current package";
2570  help_texts.add () =  "show  versions <package> :  visible versions of the selected <package>";
2571  help_texts.add () =  "system                  : display the system tag";
2572  help_texts.add () =  "unlock [<p> <v> [<path>]] : unlock a package";
2573  help_texts.add () =  "version                 : version of CMT";
2574  help_texts.add () =  "";
2575
2576  //"build <key>             : build various components :"
2577  //"show <key>              : display various infos on :"
2578
2579  help.add (action_none, help_texts[action_none]);
2580  help.add (action_awk, help_texts[action_awk]);
2581  help.add (action_broadcast, help_texts[action_broadcast]);
2582  help.add (action_build, help_texts[action_build]);
2583  help.add (action_build_constituent_makefile, help_texts[action_build_constituent_makefile]);
2584  help.add (action_build_constituent_config, help_texts[action_build_constituent_config]);
2585  help.add (action_build_constituents_makefile, help_texts[action_build_constituents_makefile]);
2586  help.add (action_build_constituents_config, help_texts[action_build_constituents_config]);
2587  help.add (action_build_broadcast_config, help_texts[action_build_broadcast_config]);
2588  help.add (action_build_dependencies, help_texts[action_build_dependencies]);
2589  help.add (action_build_library_links, help_texts[action_build_library_links]);
2590  help.add (action_build_make_setup, help_texts[action_build_make_setup]);
2591  help.add (action_build_msdev, help_texts[action_build_msdev]);
2592  help.add (action_build_CMT_pacman, help_texts[action_build_CMT_pacman]);
2593  help.add (action_build_vsnet, help_texts[action_build_vsnet]);
2594  help.add (action_build_os9_makefile, help_texts[action_build_os9_makefile]);
2595  help.add (action_build_prototype, help_texts[action_build_prototype]);
2596  help.add (action_build_readme, help_texts[action_build_readme]);
2597  help.add (action_build_tag_makefile, help_texts[action_build_tag_makefile]);
2598  help.add (action_build_temporary_name, help_texts[action_build_temporary_name]);
2599  help.add (action_build_triggers, help_texts[action_build_triggers]);
2600  help.add (action_build_windefs, help_texts[action_build_windefs]);
2601  help.add (action_check_configuration, help_texts[action_check_configuration]);
2602  help.add (action_check_files, help_texts[action_check_files]);
2603  help.add (action_check_version, help_texts[action_check_version]);
2604  help.add (action_checkout, help_texts[action_checkout]);
2605  help.add (action_cleanup, help_texts[action_cleanup]);
2606  help.add (action_config, help_texts[action_config]);
2607  help.add (action_create, help_texts[action_create]);
2608  help.add (action_create_project, help_texts[action_create_project]);
2609  help.add (action_cvsbranches, help_texts[action_cvsbranches]);
2610  help.add (action_cvssubpackages, help_texts[action_cvssubpackages]);
2611  help.add (action_cvssubprojects, help_texts[action_cvssubprojects]);
2612  help.add (action_cvstags, help_texts[action_cvstags]);
2613  help.add (action_do, help_texts[action_do]);
2614  help.add (action_expand_model, help_texts[action_expand_model]);
2615  help.add (action_filter, help_texts[action_filter]);
2616  help.add (action_help, help_texts[action_help]);
2617  help.add (action_load, help_texts[action_load]);
2618  help.add (action_lock, help_texts[action_lock]);
2619  help.add (action_relocate, help_texts[action_relocate]);
2620  help.add (action_remove, help_texts[action_remove]);
2621  help.add (action_remove_library_links, help_texts[action_remove_library_links]);
2622  help.add (action_run, help_texts[action_run]);
2623  help.add (action_run_sequence, help_texts[action_run_sequence]);
2624  help.add (action_set_version, help_texts[action_set_version]);
2625  help.add (action_set_versions, help_texts[action_set_versions]);
2626  help.add (action_setup, help_texts[action_setup]);
2627  help.add (action_show, help_texts[action_show]);
2628  help.add (action_show_action, help_texts[action_show_action]);
2629  help.add (action_show_action_value, help_texts[action_show_action_value]);
2630  help.add (action_show_action_names, help_texts[action_show_action_names]);
2631  help.add (action_show_actions, help_texts[action_show_actions]);
2632  help.add (action_show_alias, help_texts[action_show_alias]);
2633  help.add (action_show_alias_value, help_texts[action_show_alias_value]);
2634  help.add (action_show_alias_names, help_texts[action_show_alias_names]);
2635  help.add (action_show_aliases, help_texts[action_show_aliases]);
2636  help.add (action_show_all_tags, help_texts[action_show_all_tags]);
2637  help.add (action_show_applied_patterns, help_texts[action_show_applied_patterns]);
2638  help.add (action_show_author, help_texts[action_show_author]);
2639  help.add (action_show_branches, help_texts[action_show_branches]);
2640  help.add (action_show_clients, help_texts[action_show_clients]);
2641  help.add (action_show_cmtpath_patterns, help_texts[action_show_cmtpath_patterns]);
2642  help.add (action_show_constituent, help_texts[action_show_constituent]);
2643  help.add (action_show_constituent_names, help_texts[action_show_constituent_names]);
2644  help.add (action_show_constituents, help_texts[action_show_constituents]);
2645  help.add (action_show_container, help_texts[action_show_container]);
2646  help.add (action_show_cycles, help_texts[action_show_cycles]);
2647  help.add (action_show_fragment, help_texts[action_show_fragment]);
2648  help.add (action_show_fragments, help_texts[action_show_fragments]);
2649  help.add (action_show_groups, help_texts[action_show_groups]);
2650  help.add (action_show_include_dirs, help_texts[action_show_include_dirs]);
2651  help.add (action_show_language, help_texts[action_show_language]);
2652  help.add (action_show_languages, help_texts[action_show_languages]);
2653  help.add (action_show_macro, help_texts[action_show_macro]);
2654  help.add (action_show_macro_value, help_texts[action_show_macro_value]);
2655  help.add (action_show_macro_names, help_texts[action_show_macro_names]);
2656  help.add (action_show_macros, help_texts[action_show_macros]);
2657  help.add (action_show_manager, help_texts[action_show_manager]);
2658  help.add (action_show_packages, help_texts[action_show_packages]);
2659  help.add (action_show_path, help_texts[action_show_path]);
2660  help.add (action_show_pattern, help_texts[action_show_pattern]);
2661  help.add (action_show_pattern_names, help_texts[action_show_pattern_names]);
2662  help.add (action_show_patterns, help_texts[action_show_patterns]);
2663  help.add (action_show_projects, help_texts[action_show_projects]);
2664  help.add (action_show_project_author, help_texts[action_show_project_author]);
2665  help.add (action_show_setup, help_texts[action_show_setup]);
2666  help.add (action_show_pwd, help_texts[action_show_pwd]);
2667  help.add (action_show_set, help_texts[action_show_set]);
2668  help.add (action_show_set_names, help_texts[action_show_set_names]);
2669  help.add (action_show_set_value, help_texts[action_show_set_value]);
2670  help.add (action_show_sets, help_texts[action_show_sets]);
2671  help.add (action_show_strategies, help_texts[action_show_strategies]);
2672  help.add (action_show_tags, help_texts[action_show_tags]);
2673  help.add (action_show_use_paths, help_texts[action_show_use_paths]);
2674  help.add (action_show_uses, help_texts[action_show_uses]);
2675  help.add (action_show_version, help_texts[action_show_version]);
2676  help.add (action_show_versions, help_texts[action_show_versions]);
2677  help.add (action_system, help_texts[action_system]);
2678  help.add (action_unlock, help_texts[action_unlock]);
2679  help.add (action_version, help_texts[action_version]);
2680}
2681
Note: See TracBrowser for help on using the repository browser.