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

Last change on this file since 590 was 590, checked in by rybkin, 13 years ago

See C.L. 467

  • Property svn:eol-style set to native
File size: 69.9 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 > 0)
1017    {
1018      fill_arguments ();
1019      cmt.m_action = action_create;
1020    }
1021  else
1022    {
1023      CmtMessage::error ("syntax: create arguments missing");
1024      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : create arguments missing" << endl;
1025      help_action = action_help;
1026      cmt.m_action = action_create;
1027    }
1028}
1029
1030void ArgParser::do_create_project ()
1031{
1032  if (argc > 0)
1033    {
1034      fill_arguments ();
1035      cmt.m_action = action_create_project;
1036    }
1037  else
1038    {
1039      CmtMessage::error ("syntax: create_project arguments missing");
1040      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : create_project arguments missing" << endl;
1041      help_action = action_help;
1042      cmt.m_action = action_create_project;
1043    }
1044}
1045
1046void ArgParser::do_cvsbranches ()
1047{
1048  if (argc > 0)
1049    {
1050      fill_one_argument ();
1051      cmt.m_action = action_cvsbranches;
1052    }
1053  else
1054    {
1055      CmtMessage::error ("syntax: cvsbranches arguments missing");
1056      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : cvsbranches arguments missing" << endl;
1057      help_action = action_help;
1058      cmt.m_action = action_cvsbranches;
1059    }
1060}
1061
1062void ArgParser::do_cvssubpackages ()
1063{
1064  if (argc > 0)
1065    {
1066      fill_one_argument ();
1067    }
1068
1069  cmt.m_action = action_cvssubpackages;
1070}
1071
1072void ArgParser::do_cvssubprojects ()
1073{
1074  if (argc > 0)
1075    {
1076      fill_one_argument ();
1077    }
1078
1079  cmt.m_action = action_cvssubprojects;
1080}
1081
1082void ArgParser::do_cvstags ()
1083{
1084  if (argc > 0)
1085    {
1086      fill_arguments ();
1087      cmt.m_action = action_cvstags;
1088    }
1089  else
1090    {
1091      CmtMessage::error ("syntax: package name missing");
1092      help_action = action_help;
1093      cmt.m_action = action_cvstags;
1094    }
1095}
1096
1097void ArgParser::do_do ()
1098{
1099  if (argc > 0)
1100    {
1101      fill_arguments ();
1102                 
1103      {
1104        cmt_string tag_name = "target_";
1105        tag_name += arguments[0];
1106
1107        Tag* tag;
1108        tag = Tag::add (tag_name, PriorityUserTag, "action", 0);                     
1109        tag->mark ("action");
1110      }
1111
1112      cmt.m_action = action_do;
1113    }
1114  else
1115    {
1116      CmtMessage::error ("syntax: action not specified");
1117      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : action not specified" << endl;
1118      help_action = action_help;
1119      cmt.m_action = action_do;
1120    }
1121}
1122
1123void ArgParser::do_expand ()
1124{
1125  if (argc > 0)
1126    {
1127      arg = argv[0];
1128
1129      shift ();
1130      if (arg == "model")
1131        {
1132          if (argc > 0)
1133            {
1134              fill_arguments ();
1135              cmt.m_action = action_expand_model;
1136            }
1137          else
1138            {
1139              CmtMessage::error ("syntax: model not specified");
1140              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : model not specified" << endl;
1141              help_action = action_help;
1142              cmt.m_action = action_expand_model;
1143            }
1144        }
1145      else
1146        {
1147          CmtMessage::error ("syntax: bad expand option");
1148          //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad expand option" << endl;
1149          help_action = action_help;
1150          cmt.m_action = action_expand_model;
1151        }
1152    }
1153  else
1154    {
1155      CmtMessage::error ("syntax: don't know what to expand");
1156      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to expand" << endl;
1157      help_action = action_help;
1158      cmt.m_action = action_expand_model;
1159    }
1160}
1161
1162void ArgParser::do_filter ()
1163{
1164  if (argc > 0)
1165    {
1166      fill_arguments ();
1167      cmt.m_action = action_filter;
1168    }
1169  else
1170    {
1171      CmtMessage::error ("syntax: file to filter not specified");
1172      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : file to filter not specified" << endl;
1173      help_action = action_help;
1174      cmt.m_action = action_filter;
1175    }
1176}
1177
1178void ArgParser::do_help ()
1179{
1180  help_action = action_help;
1181}
1182
1183void ArgParser::do_lock ()
1184{
1185  if (argc > 0)
1186    {
1187      cmt.m_current_package = fill_one_argument ();
1188      cmt.m_current_version.erase (0);
1189      cmt.m_current_path.erase (0);
1190
1191      if (argc > 0)
1192        {
1193          cmt.m_current_version = fill_one_argument ();
1194          cmt.m_action = action_lock;
1195
1196          if (argc > 0)
1197            {
1198              cmt.m_current_path = fill_one_argument_filtered ();
1199            }
1200
1201          cmt.m_current_access = UserMode;
1202          (Use::current()).set (cmt.m_current_package, 
1203                                cmt.m_current_version, 
1204                                cmt.m_current_path);
1205
1206        }
1207      else
1208        {
1209          CmtMessage::error ("syntax: version missing");
1210          //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : version missing" << endl;
1211          help_action = action_help;
1212          cmt.m_action = action_lock;
1213        }
1214    }
1215  else
1216    {
1217      cmt.m_action = action_lock;
1218    }
1219}
1220
1221
1222void ArgParser::do_relocate ()
1223{
1224  cmt.m_action = action_relocate;
1225}
1226
1227
1228void ArgParser::do_remove ()
1229{
1230  if (argc > 0)
1231    {
1232      arg = argv[0];
1233
1234      if (arg == "library_links")
1235        {
1236          shift ();
1237          cmt.m_action = action_remove_library_links;
1238        }
1239      else
1240        {
1241          cmt.m_current_package = fill_one_argument ();
1242          cmt.m_current_version.erase (0);
1243          cmt.m_current_path.erase (0);
1244                     
1245          if (argc > 0)
1246            {
1247              cmt.m_current_version = fill_one_argument ();
1248
1249              if (argc > 0)
1250                {
1251                  cmt.m_current_path = fill_one_argument_filtered ();
1252                }
1253                           
1254              cmt.m_action = action_remove;
1255            }
1256          else
1257            {
1258              CmtMessage::error ("syntax: version missing");
1259              help_action = action_help;
1260              cmt.m_action = action_remove;
1261            }
1262        }
1263    }
1264  else
1265    {
1266      CmtMessage::error ("syntax: don't know what to remove");
1267      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to remove" << endl;
1268      help_action = action_help;
1269      cmt.m_action = action_remove;
1270    }
1271}
1272
1273void ArgParser::do_run ()
1274{
1275  if (argc > 0)
1276    {
1277      fill_arguments ();
1278      cmt.m_action = action_run;
1279    }
1280  else
1281    {
1282      CmtMessage::error ("syntax: run arguments missing");
1283      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : run arguments missing" << endl;
1284      help_action = action_help;
1285      cmt.m_action = action_run;
1286    }
1287}
1288
1289void ArgParser::do_run_sequence ()
1290{
1291  if (argc > 0)
1292    {
1293      fill_one_argument ();
1294      cmt.m_action = action_run_sequence;
1295    }
1296  else
1297    {
1298      CmtMessage::error ("syntax: run_sequence arguments missing");
1299      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : run_sequence arguments missing" << endl;
1300      help_action = action_help;
1301      cmt.m_action = action_run_sequence;
1302    }
1303}
1304
1305void ArgParser::do_set ()
1306{
1307  if (argc > 0)
1308    {
1309      arg = argv[0];
1310
1311      shift ();
1312
1313      if (arg == "version")
1314        {
1315          fill_arguments ();
1316          cmt.m_action = action_set_version;
1317        }
1318      else if (arg == "versions")
1319        {
1320          fill_arguments ();
1321
1322          cmt.m_action = action_set_versions;
1323
1324          if (cmt.m_scope_filtering_mode == default_filtering_mode)
1325            {
1326              cmt.m_scope_filtering_mode = reach_private_uses;
1327            }
1328        }
1329      else
1330        {
1331          CmtMessage::error ("syntax: bad set argument");
1332          //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad set argument" << endl;
1333          help_action = action_help;
1334          //cmt.m_action = action_set;
1335        }
1336    }
1337  else
1338    {
1339      CmtMessage::error ("syntax: don't know what to set");
1340      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to set" << endl;
1341      help_action = action_help;
1342      //cmt.m_action = action_set;
1343    }
1344}
1345
1346void ArgParser::do_setup ()
1347{
1348  cmt.m_action = action_setup;
1349  //cmt.m_warnings = true;
1350}
1351
1352void ArgParser::do_show ()
1353{
1354  if (argc > 0)
1355    {
1356      arg = argv[0];
1357
1358      //cerr << "Running show arg=" << arg << endl;
1359
1360      shift ();
1361
1362      if (arg == "action")
1363        {
1364          if (argc > 0)
1365            {
1366              cmt.m_current_target = fill_one_argument ();
1367              cmt.m_action = action_show_action;
1368            }
1369          else
1370            {
1371              CmtMessage::error ("syntax: action name missing");
1372              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : action name missing" << endl;
1373              help_action = action_help;
1374              cmt.m_action = action_show_action;
1375            }
1376        }
1377      else if (arg == "action_names")
1378        {
1379          if (argc > 0)
1380            {
1381              fill_one_argument ();
1382            }
1383
1384          cmt.m_action = action_show_action_names;
1385        }
1386      else if (arg == "action_value")
1387        {
1388          cmt.m_quiet = true;
1389          if (argc > 0)
1390            {
1391              cmt.m_current_target = fill_one_argument ();
1392              cmt.m_action = action_show_action_value;
1393            }
1394          else
1395            {
1396              CmtMessage::error ("syntax: action name missing");
1397              help_action = action_help;
1398              cmt.m_action = action_show_action_value;
1399            }
1400        }
1401      else if (arg == "actions")
1402        {
1403          if (argc > 0)
1404            {
1405              fill_one_argument ();
1406            }
1407
1408          cmt.m_action = action_show_actions;
1409        }
1410      else if (arg == "all_tags")
1411        {
1412          cmt.m_action = action_show_all_tags;
1413        }
1414      else if (arg == "applied_patterns")
1415        {
1416          cmt.m_action = action_show_applied_patterns;
1417        }
1418      else if (arg == "author")
1419        {
1420          cmt.m_action = action_show_author;
1421        }
1422      else if (arg == "branches")
1423        {
1424          cmt.m_action = action_show_branches;
1425        }
1426      else if (arg == "clients")
1427        {
1428          if (argc > 0)
1429            {
1430              cmt.m_current_target = fill_one_argument ();
1431
1432              cmt.m_action = action_show_clients;
1433
1434              if (argc > 0)
1435                {
1436                  fill_one_argument ();
1437                  if (argc > 0)
1438                    {
1439                      fill_one_argument ();
1440                    }
1441                }
1442            }
1443          else
1444            {
1445              CmtMessage::error ("syntax: package name missing");
1446              help_action = action_help;
1447              cmt.m_action = action_show_clients;
1448            }
1449        }
1450      else if (arg == "cmtpath_patterns")
1451        {
1452          cmt.m_action = action_show_cmtpath_patterns;
1453        }
1454      else if (arg == "constituent")
1455        {
1456          if (argc > 0)
1457            {
1458              cmt.m_current_target = fill_one_argument ();
1459              cmt.m_action = action_show_constituent;
1460            }
1461          else
1462            {
1463              CmtMessage::error ("syntax: constituent name missing");
1464              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : constituent name missing" << endl;
1465              help_action = action_help;
1466              cmt.m_action = action_show_constituent;
1467            }
1468        }
1469      else if (arg == "constituent_names")
1470        {
1471          cmt.m_action = action_show_constituent_names;
1472        }
1473      else if (arg == "constituents")
1474        {
1475          cmt.m_action = action_show_constituents;
1476        }
1477      else if (arg == "container")
1478        {
1479          if (argc > 0)
1480            {
1481              fill_arguments ();
1482            }
1483          cmt.m_action = action_show_container;
1484        }
1485      else if (arg == "cycles")
1486        {
1487          cmt.m_action = action_show_cycles;
1488        }
1489      else if (arg == "fragment")
1490        {
1491          if (argc > 0)
1492            {
1493              cmt.m_current_target = fill_one_argument ();
1494              cmt.m_action = action_show_fragment;
1495            }
1496          else
1497            {
1498              CmtMessage::error ("syntax: fragment name missing");
1499              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : fragment name missing" << endl;
1500              help_action = action_help;
1501              cmt.m_action = action_show_fragment;
1502            }
1503        }
1504      else if (arg == "fragments")
1505        {
1506          cmt.m_action = action_show_fragments;
1507        }
1508      else if (arg == "groups")
1509        {
1510          cmt.m_action = action_show_groups;
1511        }
1512      else if (arg == "include_dirs")
1513        {
1514          cmt.m_action = action_show_include_dirs;
1515        }
1516      else if (arg == "language")
1517        {
1518          if (argc > 0)
1519            {
1520              cmt.m_current_target = fill_one_argument ();
1521              cmt.m_action = action_show_language;
1522            }
1523          else
1524            {
1525              CmtMessage::error ("syntax: language name missing");
1526              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : language name missing" << endl;
1527              help_action = action_help;
1528              cmt.m_action = action_show_language;
1529            }
1530        }
1531      else if (arg == "languages")
1532        {
1533          cmt.m_action = action_show_languages;
1534        }
1535      else if (arg == "macro")
1536        {
1537          if (argc > 0)
1538            {
1539              cmt.m_current_target = fill_one_argument ();
1540              cmt.m_action = action_show_macro;
1541            }
1542          else
1543            {
1544              CmtMessage::error ("syntax: macro name missing");
1545              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : macro name missing" << endl;
1546              help_action = action_help;
1547              cmt.m_action = action_show_macro;
1548            }
1549        }
1550      else if (arg == "macro_names")
1551        {
1552          if (argc > 0)
1553            {
1554              fill_one_argument ();
1555            }
1556
1557          cmt.m_action = action_show_macro_names;
1558        }
1559      else if (arg == "macro_value")
1560        {
1561          cmt.m_quiet = true;
1562          if (argc > 0)
1563            {
1564              cmt.m_current_target = fill_one_argument ();
1565              cmt.m_action = action_show_macro_value;
1566            }
1567          else
1568            {
1569              CmtMessage::error ("syntax: macro name missing");
1570              help_action = action_help;
1571              cmt.m_action = action_show_macro_value;
1572            }
1573        }
1574      else if (arg == "macros")
1575        {
1576          if (argc > 0)
1577            {
1578              fill_one_argument ();
1579            }
1580
1581          cmt.m_action = action_show_macros;
1582        }
1583      else if (arg == "manager")
1584        {
1585          cmt.m_action = action_show_manager;
1586        }
1587      else if (arg == "packages")
1588        {
1589          if (argc > 0)
1590            {
1591              fill_arguments ();
1592              //              cmt.m_current_target = fill_one_argument ();
1593            }
1594
1595          cmt.m_action = action_show_packages;
1596        }
1597      else if (arg == "path")
1598        {
1599          if (argc == 0)
1600            {
1601              cmt.m_action = action_show_path;
1602            }
1603          else if (argc == 1 && cmt_string (argv[0]) == "-d")
1604            {
1605              fill_one_argument ();
1606              cmt.m_action = action_show_path;
1607            }
1608          else
1609            {
1610              cmt.m_action = action_show_path;
1611              help_action = action_help;
1612            }
1613        }
1614      else if (arg == "pattern")
1615        {
1616          if (argc > 0)
1617            {
1618              cmt.m_current_target = fill_one_argument ();
1619              cmt.m_action = action_show_pattern;
1620            }
1621          else
1622            {
1623              CmtMessage::error ("syntax: pattern name missing");
1624              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : pattern name missing" << endl;
1625              help_action = action_help;
1626              cmt.m_action = action_show_pattern;
1627            }
1628        }
1629      else if (arg == "pattern_names")
1630        {
1631          cmt.m_action = action_show_pattern_names;
1632        }
1633      else if (arg == "patterns")
1634        {
1635          cmt.m_action = action_show_patterns;
1636        }
1637      else if (arg == "projects")
1638        {
1639          cmt.m_action = action_show_projects;
1640        }
1641        else if (arg == "project_author")
1642        {
1643          cmt.m_action = action_show_project_author;
1644        }
1645
1646      else if (arg == "pwd")
1647        {
1648          cmt.m_action = action_show_pwd;
1649        }
1650      else if (arg == "setup")
1651        {
1652          cmt.m_action = action_show_setup;
1653
1654          if (cmt.m_scope_filtering_mode == default_filtering_mode)
1655            {
1656              cmt.m_scope_filtering_mode = reach_private_uses;
1657            }
1658        }
1659      else if (arg == "set_names")
1660        {
1661          if (argc > 0)
1662            {
1663              fill_one_argument ();
1664            }
1665
1666          cmt.m_action = action_show_set_names;
1667        }
1668      else if (arg == "set_value")
1669        {
1670          cmt.m_quiet = true;
1671          if (argc > 0)
1672            {
1673              cmt.m_current_target = fill_one_argument ();
1674              cmt.m_action = action_show_set_value;
1675            }
1676          else
1677            {
1678              CmtMessage::error ("syntax: set name missing");
1679              //              if (!cmt.m_quiet) cerr << "#CMT> syntax error : set name missing" << endl;
1680              help_action = action_help;
1681              cmt.m_action = action_show_set_value;
1682            }
1683        }
1684      else if (arg == "set")
1685        {
1686          if (argc > 0)
1687            {
1688              cmt.m_current_target = fill_one_argument ();
1689              cmt.m_action = action_show_set;
1690            }
1691          else
1692            {
1693              CmtMessage::error ("syntax: set name missing");
1694              help_action = action_help;
1695              cmt.m_action = action_show_set;
1696            }
1697        }
1698      else if (arg == "sets")
1699        {
1700          if (argc > 0)
1701            {
1702              fill_one_argument ();
1703            }
1704
1705          cmt.m_action = action_show_sets;
1706        }
1707      else if (arg == "strategies")
1708        {
1709          cmt.m_action = action_show_strategies;
1710        }
1711      else if (arg == "tags")
1712        {
1713          cmt.m_action = action_show_tags;
1714        }
1715      else if (arg == "use_paths")
1716        {
1717          if (argc > 0)
1718            {
1719              while (argc > 0)
1720                {
1721                  if (strcmp (argv[0], "-private") == 0)
1722                    {
1723                      cmt.m_scope_filtering_mode = reach_private_uses;
1724                    }
1725                  else if (strcmp (argv[0], "--private") == 0)
1726                    {
1727                      cmt.m_scope_filtering_mode = reach_private_uses;
1728                    }
1729                  else
1730                    {
1731                      cmt_string& s = arguments.add ();
1732                      s = argv[0];
1733                    }
1734
1735                  shift ();
1736                }
1737
1738              cmt.m_action = action_show_use_paths;
1739            }
1740          else
1741            {
1742              CmtMessage::error ("syntax: package name missing");
1743              help_action = action_help;
1744              cmt.m_action = action_show_use_paths;
1745            }
1746        }
1747      else if ((arg == "u") ||
1748               (arg == "us") ||
1749               (arg == "use") ||
1750               (arg == "uses"))
1751        {
1752          cmt.m_action = action_show_uses;
1753
1754          if (cmt.m_scope_filtering_mode == default_filtering_mode)
1755            {
1756              cmt.m_scope_filtering_mode = reach_private_uses;
1757            }
1758        }
1759      else if (arg == "version")
1760        {
1761          cmt.m_action = action_show_version;
1762        }
1763      else if (arg == "versions")
1764        {
1765          if (argc > 0)
1766            {
1767              cmt.m_current_target = fill_one_argument ();
1768              cmt.m_action = action_show_versions;
1769            }
1770          else
1771            {
1772              CmtMessage::error ("syntax: package name missing");
1773              help_action = action_help;
1774              cmt.m_action = action_show_versions;
1775            }
1776        }
1777      else
1778        {
1779          CmtMessage::error ("syntax: bad show argument");
1780          //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad show argument" << endl;
1781          help_action = action_help;
1782          cmt.m_action = action_show;
1783        }
1784    }
1785  else
1786    {
1787      CmtMessage::error ("syntax: don't know what to show");
1788      //      if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to show" << endl;
1789      help_action = action_help;
1790      cmt.m_action = action_show;
1791    }
1792}
1793
1794void ArgParser::do_system ()
1795{
1796  cmt.m_action = action_system;
1797}
1798
1799void ArgParser::do_unlock ()
1800{
1801  if (argc > 0)
1802    {
1803      cmt.m_current_package = fill_one_argument ();
1804      cmt.m_current_version.erase (0);
1805      cmt.m_current_path.erase (0);
1806                                       
1807      if (argc > 0)
1808        {
1809          cmt.m_current_version = fill_one_argument ();
1810          cmt.m_action = action_unlock;
1811
1812          if (argc > 0)
1813            {
1814              cmt.m_current_path = fill_one_argument_filtered ();
1815            }
1816                                               
1817          cmt.m_current_access = UserMode;
1818          (Use::current()).set (cmt.m_current_package, 
1819                                cmt.m_current_version, 
1820                                cmt.m_current_path);
1821
1822        }
1823      else
1824        {
1825          CmtMessage::error ("syntax: version missing");
1826          help_action = action_help;
1827          cmt.m_action = action_unlock;
1828        }
1829    }
1830  else
1831    {
1832      cmt.m_action = action_unlock;
1833    }
1834}
1835
1836void ArgParser::do_version ()
1837{
1838  cmt.m_action = action_version;
1839}
1840
1841void ArgParser::option_help ()
1842{
1843  help_action = action_help;
1844}
1845
1846void ArgParser::option_n ()
1847{
1848  cmt.m_simulation = true;
1849}
1850
1851
1852void ArgParser::option_disable_warnings ()
1853{
1854  cmt.m_disable_warnings = true;
1855  if (CmtMessage::level () <= Warning)
1856    CmtMessage::set_level (Error);
1857}
1858
1859void ArgParser::option_quiet ()
1860{
1861  cmt.m_quiet = true;
1862  if (CmtMessage::level () <= Error)
1863    CmtMessage::set_level (Fatal);
1864}
1865
1866
1867void ArgParser::option_warnings ()
1868{
1869  cmt.m_warnings = true;
1870  if (CmtMessage::level () != Warning)
1871    CmtMessage::set_level (Warning);
1872}
1873
1874void ArgParser::option_csh ()
1875{
1876  mode = Csh;
1877}
1878
1879void ArgParser::option_sh ()
1880{
1881  mode = Sh;
1882}
1883
1884void ArgParser::option_bat ()
1885{
1886  mode = Bat;
1887}
1888
1889void ArgParser::option_requirements ()
1890{
1891  mode = Requirements;
1892}
1893
1894void ArgParser::option_xml ()
1895{
1896  mode = Xml;
1897}
1898
1899void ArgParser::option_use ()
1900{
1901  if (cmt.m_action != action_create)
1902    {
1903      CmtSystem::cmt_string_vector words;
1904
1905      CmtSystem::split (arg, ":", words);
1906
1907      cmt.m_current_access = UserMode;
1908
1909      if (words.size () > 0) cmt.m_current_package = words[0];
1910      if (words.size () > 1) cmt.m_current_version = words[1];
1911      if (words.size () > 2) cmt.m_current_path    = words[2];
1912      (Use::current()).set (cmt.m_current_package, 
1913                            cmt.m_current_version, 
1914                            cmt.m_current_path);
1915
1916      Use& use = Use::current();
1917      if (use.get_package_name () == "cmt_standalone")
1918        {
1919          if (!CmtSystem::cd (use.path) || !CmtSystem::test_file ("requirements"))
1920            {
1921              CmtError::set (CmtError::package_not_found, use.get_info ());
1922              return;
1923            }
1924          use.style = none_style;
1925          use.structuring_style = without_version_directory;
1926          use.change_path (CmtSystem::pwd ());
1927        }
1928      else if (!use.move_to ("", true))
1929        {
1930          CmtError::set (CmtError::package_not_found, use.get_info ());
1931          return;
1932        }
1933      Project::order_all ();
1934      Cmt::guess_current_project ();
1935    }
1936}
1937
1938void ArgParser::option_pack ()
1939{
1940  if ((cmt.m_action != action_create) && (cmt.m_current_package != arg))
1941    {
1942      //CmtSystem::cd (cmt.m_default_path);
1943
1944      cmt.m_current_access = UserMode;
1945
1946      cmt.m_current_package = arg;
1947      cmt.m_current_version = "";
1948
1949      /*
1950      cerr << "ArgParser::option_pack> "
1951           << " cp=" << cmt.m_current_package
1952           << " cv=" << cmt.m_current_version
1953           << " cp=" << cmt.m_current_path << endl;
1954      */
1955
1956      (Use::current()).set (cmt.m_current_package, 
1957                            cmt.m_current_version, 
1958                            cmt.m_current_path);
1959    }
1960}
1961
1962void ArgParser::option_version ()
1963{
1964  if ((cmt.m_action != action_create) && (cmt.m_current_version != arg))
1965    {
1966      cmt.m_current_access = UserMode;
1967      cmt.m_current_version = arg;
1968
1969      /*
1970      cerr << "ArgParser::option_version> "
1971           << " cp=" << cmt.m_current_package
1972           << " cv=" << cmt.m_current_version
1973           << " cp=" << cmt.m_current_path << endl;
1974      */
1975
1976      (Use::current()).set (cmt.m_current_package, 
1977                            cmt.m_current_version, 
1978                            cmt.m_current_path);
1979    }
1980}
1981
1982void ArgParser::option_path ()
1983{
1984  if ((cmt.m_action != action_create) && (cmt.m_current_path != arg))
1985    {
1986      cmt.m_current_access = UserMode;
1987      cmt.m_current_path = arg;
1988
1989      /*
1990      cerr << "ArgParser::option_path> "
1991           << " cp=" << cmt.m_current_package
1992           << " cv=" << cmt.m_current_version
1993           << " cp=" << cmt.m_current_path << endl;
1994      */
1995
1996      (Use::current()).set (cmt.m_current_package, 
1997                            cmt.m_current_version, 
1998                            cmt.m_current_path);
1999
2000      //IProjectFactory& factory = ProjectFactory::instance ();
2001      //CmtSystem::add_cmt_path (cmt.m_current_path, "argument", factory);
2002      Use& use = Use::current();
2003      if (use.get_package_name () == "cmt_standalone")
2004        {
2005          if (!CmtSystem::cd (use.path) || !CmtSystem::test_file ("requirements"))
2006            {
2007              CmtError::set (CmtError::package_not_found, use.get_info ());
2008              return;
2009            }
2010          use.style = none_style;
2011          use.structuring_style = without_version_directory;
2012          use.change_path (CmtSystem::pwd ());
2013        }
2014      else if (!use.move_to ("", true))
2015        {
2016          CmtError::set (CmtError::package_not_found, use.get_info ());
2017          return;
2018        }
2019      Project::order_all ();
2020      Cmt::guess_current_project ();
2021    }
2022}
2023
2024void ArgParser::option_f ()
2025{
2026  extra_file = arg;
2027}
2028
2029void ArgParser::option_e ()
2030{
2031  //CmtMessage::warning ("extra statement = " + arg);
2032  extra_line = arg;
2033}
2034
2035void ArgParser::option_home ()
2036{
2037  if (CmtSystem::test_directory (arg))
2038    {
2039      cmt.m_cmt_home = arg;
2040    }
2041}
2042
2043void ArgParser::option_tag ()
2044{
2045  /*
2046    Here we are going to change the complete tag set
2047  */
2048  if (arg != "")
2049    {
2050      Tag* tag;
2051      CmtSystem::cmt_string_vector words;
2052
2053      // First reset selection of all existing tags
2054      //Tag::clear_all ();
2055      Tag::unmark_all ();
2056      cmt.m_extra_tags = ",";
2057                   
2058      // Then restore CMTSITE
2059      Cmt::configure_version_tag ();
2060      Cmt::configure_site_tag (0);
2061      Cmt::configure_uname_tag ();
2062      Cmt::configure_hosttype_tag ();
2063      Cmt::configure_config_tag ();
2064      Cmt::configure_home (0);
2065      Cmt::guess_current_project ();
2066
2067      CmtSystem::split (arg, " \t,", words);
2068                 
2069      for (int i = 0; i < words.size (); i++)
2070        {
2071          const cmt_string& a = words[i];
2072      //if (!cmt.m_quiet) cout  << "parse_argument(tag_add)> current_tag=" << a << endl;                     
2073          cmt_string s = ",";
2074          s += a;
2075          s += ",";
2076                     
2077          if (i == 0)
2078            {
2079              cmt.m_current_tag = a;
2080                         
2081              if (CmtSystem::testenv ("TAGDEBUG")) 
2082              cerr << "parse_argument(tag_add)> current_tag=" << cmt.m_current_tag << endl;
2083            }
2084                     
2085          if (cmt.m_extra_tags.find (s) == cmt_string::npos)
2086            {
2087              //if (!cmt.m_quiet) cerr << "  a=[" << a << "]" << endl;
2088                         
2089              // Then restore uname if the specified tag is CMTCONFIG
2090              if (a == CmtSystem::get_cmt_config ())
2091                {
2092                  Cmt::configure_uname_tag ();
2093                }
2094                         
2095              tag = Tag::add (a, PriorityArgument, "arguments", 0);
2096              tag->mark ("arguments");
2097              cmt.m_extra_tags += a;
2098              cmt.m_extra_tags += ",";
2099            }
2100        }
2101        // To be sure that a tag
2102        Cmt::guess_current_project ();
2103    }
2104}
2105
2106void ArgParser::option_tag_add ()
2107{
2108  Tag* tag;
2109  CmtSystem::cmt_string_vector words;
2110 
2111
2112  CmtSystem::split (arg, " \t,", words);
2113
2114  for (int i = 0; i < words.size (); i++)
2115    {
2116      const cmt_string& a = words[i];
2117
2118      cmt_string s = ",";
2119      s += a;
2120      s += ",";
2121
2122      if (cmt.m_extra_tags.find (s) == cmt_string::npos)
2123        {
2124          //if (!cmt.m_quiet) cerr << "  a=[" << a << "]" << endl;
2125
2126          /// Then restore uname if the specified tag is CMTCONFIG
2127          if (a == CmtSystem::get_cmt_config ())
2128            {
2129              Cmt::configure_uname_tag ();
2130            }
2131                     
2132          tag = Tag::add (a, PriorityUserTag, "arguments", 0);
2133                     
2134          tag->mark ("arguments");
2135
2136          cmt.m_extra_tags += a;
2137          cmt.m_extra_tags += ",";
2138        }
2139    }
2140}
2141
2142void ArgParser::option_tag_remove ()
2143{
2144  Tag::TagPtrVector tags = Tag::tags ();
2145  int i;
2146  Tag* tag;
2147
2148  /*
2149    for (i = 0; i < tags.size (); i++)
2150    {
2151    tag = tags[i];
2152    if ((tag != 0) &&
2153    (tag->selected))
2154    {
2155    if (!cmt.m_quiet) cerr << "  original tag_list=" << tag->name << tag->priority << endl;
2156    }
2157    }
2158  */
2159
2160  CmtSystem::cmt_string_vector words;
2161
2162  //if (!cmt.m_quiet) cerr << "-arg_remove=" << arg << endl;
2163
2164  CmtSystem::split (arg, " \t,", words);
2165
2166  //
2167  // Now erase all entries in the old list that match
2168  // the specified tags
2169  //
2170
2171  for (i = 0; i < words.size (); i++)
2172    {
2173      const cmt_string& a = words[i];
2174
2175      cmt_string s = ",";
2176      s += a;
2177      s += ",";
2178
2179      int pos;
2180
2181      pos = cmt.m_extra_tags.find (s);
2182
2183      if (pos != cmt_string::npos)
2184        {
2185          cmt.m_extra_tags.erase (pos, s.size () - 1);
2186        }
2187
2188      //if (!cmt.m_quiet) cerr << "  tag_list=[" << tag_list << "]" << endl;
2189    }
2190
2191  //
2192  // Now reinject the purged list of tags into the database
2193  // exactly as when using -tag=<tag-list>
2194  //
2195
2196  /// First forget about all existing tags
2197      Tag::unmark_all ();
2198
2199      /// Then restore CMTSITE
2200        Cmt::configure_version_tag ();
2201        Cmt::configure_site_tag (0);
2202        Cmt::configure_uname_tag ();
2203        Cmt::configure_hosttype_tag ();
2204             
2205        CmtSystem::split (cmt.m_extra_tags, " \t,", words);
2206
2207        for (i = 0; i < words.size (); i++)
2208          {
2209            const cmt_string& a = words[i];
2210
2211            //fprintf (stderr, "  a=[%s]\n", a.c_str ());
2212
2213            /// Then restore uname if the specified tag is CMTCONFIG
2214              if (a == CmtSystem::get_cmt_config ())
2215                {
2216                  Cmt::configure_uname_tag ();
2217                }
2218
2219              if (i == 0)
2220                {
2221                  cmt.m_current_tag = a;
2222
2223                  //if (!cmt.m_quiet) cerr << "parse_argument(tag_remove)> current_tag="
2224                  //<< cmt.m_current_tag << endl;
2225
2226                  tag = Tag::add (a, PriorityTag, "arguments", 0);
2227                }
2228              else
2229                {
2230                  tag = Tag::add (a, PriorityUserTag, "arguments", 0);
2231                }
2232
2233              tag->mark ("arguments");
2234          }
2235}
2236
2237void ArgParser::option_user_context ()
2238{
2239  if (CmtSystem::test_directory (arg))
2240    {
2241      cmt.m_cmt_user_context = arg;
2242    }
2243}
2244
2245void ArgParser::option_with_cmt ()
2246{
2247  cmt.m_use_cmt = true;
2248  if (!Cmt::add_cmt_flag ("-with_cmt"))
2249    CmtMessage::error ("Cannot add flag `-with_cmt'");
2250}
2251
2252void ArgParser::option_without_cmt ()
2253{
2254  cmt.m_use_cmt = false;
2255  if (!Cmt::add_cmt_flag ("-without_cmt"))
2256    CmtMessage::error ("Cannot add flag `-without_cmt'");
2257}
2258
2259void ArgParser::option_with_version_directory ()
2260{
2261  cmt.m_current_structuring_style = with_version_directory;
2262
2263  StrategyDef* def = StrategyMgr::find_strategy ("VersionDirectory");
2264  if (def != 0)
2265    {
2266      def->m_default_value = true;
2267      def->m_priority_value = false;
2268    }
2269}
2270
2271void ArgParser::option_without_version_directory ()
2272{
2273  cmt.m_current_structuring_style = without_version_directory;
2274
2275  StrategyDef* def = StrategyMgr::find_strategy ("VersionDirectory");
2276  if (def != 0)
2277    {
2278      def->m_default_value = false;
2279      def->m_priority_value = true;
2280    }
2281}
2282
2283void ArgParser::option_no_cleanup ()
2284{
2285  //cmt.m_current_setup_strategy |= SetupNoCleanup;
2286}
2287
2288void ArgParser::option_private ()
2289{
2290  cmt.m_scope_filtering_mode = reach_private_uses;
2291}
2292
2293void ArgParser::option_public ()
2294{
2295  cmt.m_scope_filtering_mode = block_private_uses;
2296}
2297
2298
2299
2300
2301
2302
2303CommandHelp::HelpMap& CommandHelp::get_help ()
2304{
2305  static CommandHelp& me = instance ();
2306
2307  return (me.m_help);
2308}
2309
2310CommandHelp::HelpTexts& CommandHelp::get_help_texts ()
2311{
2312  static CommandHelp& me = instance ();
2313
2314  return (me.m_help_texts);
2315}
2316
2317const cmt_string& CommandHelp::get_help_text (ActionType key)
2318{
2319  static const HelpTexts& help = get_help_texts ();
2320
2321  const cmt_string& h = help[key];
2322  return (h);
2323}
2324
2325void CommandHelp::show_all ()
2326{
2327  static HelpTexts& help_texts = get_help_texts ();
2328
2329  cout << "#> cmt command [option...]" << endl;
2330  cout << "# command :" << endl;
2331
2332  int i;
2333
2334  for (i = 0; ; i++)
2335    {
2336      const cmt_string& s = help_texts[i];
2337      if (s == "") break;
2338      cout << "#   " << s << endl;
2339    }
2340
2341  cout << "# global options :" << endl;
2342
2343  cout << "#   -disable_warnings       : don't print warnings" << endl;
2344  cout << "#   -quiet                  : don't print errors" << endl;
2345  cout << "#   -use=<p>:<v>:<path>     : set package version path" << endl;
2346  cout << "#   -pack=<package>         : set package" << endl;
2347  cout << "#   -version=<version>      : set version" << endl;
2348  cout << "#   -path=<path>            : set root path" << endl;
2349  cout << "#   -f=<requirements-file>  : set input file" << endl;
2350  cout << "#   -e=<statement>          : add a one line statement" << endl;
2351  cout << "#   -tag=<tag-list>         : select a new tag-set" << endl;
2352  cout << "#   -tag_add=<tag-list>     : add specific comma-separated tag(s)" << endl;
2353  cout << "#   -tag_remove=<tag-list>  : remove specific comma-separated tag(s)" << endl;
2354  cout << "#   -warnings               : display various warnings" << endl;
2355  cout << "#   -with_version_directory : reset to default structuring style" << endl;
2356  cout << "#   -without_version_directory : switch structuring style" << endl;
2357  cout << "#   -cleanup                : activate install area cleanup" << endl;
2358  cout << "#   -no_cleanup             : inhibit install area cleanup" << endl;
2359  cout << "#   -xml                    : output in XML format (cmt setup, cmt show projects, cmt show uses)" << endl;
2360}
2361
2362void CommandHelp::show (ActionType action)
2363{
2364  //  cerr << "CommandHelp::show> action = " << action << endl;
2365
2366  static HelpTexts& help_texts = get_help_texts ();
2367
2368  if (action == action_build)
2369    {
2370      const cmt_string& s = get_help_text (action);
2371      cout << "# " << s << endl;
2372      int i;
2373
2374      for (i = action_build_constituent_makefile; i <= action_build_windefs; i++)
2375        {
2376          const cmt_string& s = help_texts[i];
2377          cout << "#   " << s << endl;
2378        }
2379    }
2380  else if (action == action_check)
2381    {
2382      int i;
2383
2384      for (i = action_check_configuration; i <= action_check_version; i++)
2385        {
2386          const cmt_string& s = help_texts[i];
2387          cout << "#   " << s << endl;
2388        }
2389    }
2390  else if (action == action_show)
2391    {
2392      int i;
2393
2394      for (i = (action_show + 1); i <= action_show_versions; i++)
2395        {
2396          const cmt_string& s = help_texts[i];
2397          cout << "#   " << s << endl;
2398        }
2399    }
2400  else
2401    {
2402      const cmt_string& s = get_help_text (action);
2403      cout << "# " << s << endl;
2404    }
2405}
2406
2407CommandHelp& CommandHelp::instance ()
2408{
2409  static CommandHelp me;
2410  return (me);
2411}
2412
2413CommandHelp::CommandHelp ()
2414{
2415  static HelpMap& help = m_help;
2416
2417  static HelpTexts& help_texts = m_help_texts;
2418
2419  help_texts.clear ();
2420
2421  help_texts.add () =  "none";
2422  help_texts.add () =  "awk";
2423  help_texts.add () =  "broadcast [-select=list] [-exclude=list] [-local] [-global] [-begin=pattern] [-depth=n] <command> : apply a command to [some of] the used packages";
2424  help_texts.add () =  "build <argument>          : build actions. Try 'cmt help build'";
2425  //  help_texts.add () =  "build <option>          : build actions. (Try cmt help build)";
2426  help_texts.add () =  "build constituent_makefile [-out=<path>] [-with_cmt] [-without_cmt] <constituent> : generate constituent Makefile fragment";
2427  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)";
2428  help_texts.add () =  "build constituents_makefile [-out=<path>] : generate constituents Makefile";
2429  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";
2430  help_texts.add () =  "build broadcast_config [-out=<path>] : generate broadcast Makefile, and broadcast specific macros Makefile";
2431  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>]";
2432  help_texts.add () =  "build library_links     : build symbolic links towards all imported libraries";
2433  help_texts.add () =  "build make_setup        : build a compiled version of setup scripts";
2434  help_texts.add () =  "build msdev             : generate MSDEV files";
2435  help_texts.add () =  "build CMT_pacman        : generate PACMAN manifest file for CMT";
2436  help_texts.add () =  "build vsnet             : generate VS.NET files";
2437  help_texts.add () =  "build os9_makefile      : generate Makefile for OS9";
2438  help_texts.add () =  "build prototype         : generate prototype file";
2439  help_texts.add () =  "build readme            : generate README.html";
2440  help_texts.add () =  "build tag_makefile      : generate tag specific Makefile";
2441  help_texts.add () =  "build temporary_name    : generate a name for a temprary file";
2442  help_texts.add () =  "build triggers <constituent> : generate library trigger file";
2443  help_texts.add () =  "build windefs [-name=NAME] [@commandfile] (objectfile|library)... : generate def file for Windows shared library [NAME]";
2444  help_texts.add () =  "check <option>          : check actions. (Try cmt help check)";
2445  help_texts.add () =  "check configuration     : check configuration";
2446  help_texts.add () =  "check files <old> <new> : compare two files and overrides <old> by <new> if different";
2447  help_texts.add () =  "check version <name>    : check if a name follows a version tag syntax ";
2448  help_texts.add () =  "co | checkout           : perform a cvs/svn checkout over a CMT package";
2449  help_texts.add () =  "cleanup [-csh|-sh|-bat] : generate a cleanup script";
2450  help_texts.add () =  "config                  : generate setup and cleanup scripts";
2451  help_texts.add () =  "create <package> <version> [<path>] : create and configure a new package";
2452  help_texts.add () =  "create_project <project> <name> [<path>] : create and configure a new project";
2453  help_texts.add () =  "cvsbranches <module>      : display the subdirectories for a module";
2454  help_texts.add () =  "cvssubpackages <module>   : display the subpackages for a module";
2455  help_texts.add () =  "cvssubprojects <module>   : display the subprojects for a module";
2456  help_texts.add () =  "cvstags <module>          : display the CVS tags for a module";
2457  help_texts.add () =  "do <action> [<param>=<value>] ... : Execute an action";
2458  help_texts.add () =  "expand model <model>    : ";
2459  help_texts.add () =  "filter <in> <out>       : filter a file against CMT macros and env. variables";
2460  help_texts.add () =  "help | -help | --help   : display this help";
2461  help_texts.add () =  "load";
2462  help_texts.add () =  "lock [<p> <v> [<path>]] : lock a package";
2463  help_texts.add () =  "relocate                : generate only setup scripts";
2464  help_texts.add () =  "remove <package> <version> [<path>] : remove a package version";
2465  help_texts.add () =  "remove library_links    : remove symbolic links towards all imported libraries";
2466  help_texts.add () =  "run '<command>'         : apply a command";
2467  help_texts.add () =  "run_sequence <sequence file> : execute a cmt equence file";
2468  help_texts.add () =  "set version <version>   : generate a version file in the current package";
2469  help_texts.add () =  "set versions            : generate version files into packages";
2470  help_texts.add () =  "setup [-csh|-sh|-bat|-cmt|-requirements] : generate a setup script (or standalone requirements file from which generate the setup script)";
2471  help_texts.add () =  "show <option>           : query actions. (Try cmt help show)";
2472  help_texts.add () =  "show  action <name>     :  a formatted action definition";
2473  help_texts.add () =  "show  action_value <name> :  a raw action definition";
2474  help_texts.add () =  "show  action_names      :  all action names";
2475  help_texts.add () =  "show  actions           :  all action definitions";
2476  help_texts.add () =  "show  all_tags          :  all defined tags";
2477  help_texts.add () =  "show  applied_patterns  :  all patterns actually applied";
2478  help_texts.add () =  "show  author            :  package author";
2479  help_texts.add () =  "show  branches          :  added branches";
2480  help_texts.add () =  "show  clients <package> [<version> [<path>]] :  clients of <package> [of <version> [in <path>]]";
2481  help_texts.add () =  "show  cmtpath_patterns  :  cmtpath_patterns";
2482  help_texts.add () =  "show  constituent <name>:  constituent definition";
2483  help_texts.add () =  "show  constituent_names :  constituent names";
2484  help_texts.add () =  "show  constituents      :  constituent definitions";
2485  help_texts.add () =  "show  container [<path>]... :  container package of current project [or <path>s projects]";
2486  help_texts.add () =  "show  cycles            :  cycles in the use graph";
2487  help_texts.add () =  "show  fragment <name>   :  one fragment definition";
2488  help_texts.add () =  "show  fragments         :  fragment definitions";
2489  help_texts.add () =  "show  groups            :  group definitions";
2490  help_texts.add () =  "show  include_dirs      :  ";
2491  help_texts.add () =  "show  language <name>   :  language definition";
2492  help_texts.add () =  "show  languages         :  language definitions";
2493  help_texts.add () =  "show  macro <name>      :  a formatted macro definition";
2494  help_texts.add () =  "show  macro_value <name>  :  a raw macro definition";
2495  help_texts.add () =  "show  macro_names       :  all macro names";
2496  help_texts.add () =  "show  macros            :  all macro definitions";
2497  help_texts.add () =  "show  manager           :  package manager";
2498  help_texts.add () =  "show  packages [<path>]... :  packages reachable from the current context [or <path>s]";
2499  help_texts.add () =  "show  path [-d]         :  the package search paths list [in detail]";
2500  help_texts.add () =  "show  pattern <name>    :  the pattern definition and usages";
2501  help_texts.add () =  "show  pattern_names     :  pattern names";
2502  help_texts.add () =  "show  patterns          :  the pattern definitions";
2503  help_texts.add () =  "show  projects          :  project definitions";
2504  help_texts.add () =  "show  project author    :  project author";
2505  help_texts.add () =  "show  setup             :  setup definitions";
2506  help_texts.add () =  "show  pwd               :  filtered current directory";
2507  help_texts.add () =  "show  set <name>        :  a formatted set definition";
2508  help_texts.add () =  "show  set_names         :  set names";
2509  help_texts.add () =  "show  set_value <name>  :  a raw set definition";
2510  help_texts.add () =  "show  sets              :  set definitions";
2511  help_texts.add () =  "show  strategies        :  all strategies (build & version)";
2512  help_texts.add () =  "show  tags              :  all currently active tags";
2513  help_texts.add () =  "show  use_paths <package> :  all use paths to the used <package>";
2514  help_texts.add () =  "show  uses              :  used packages";
2515  help_texts.add () =  "show  version           :  version of the current package";
2516  help_texts.add () =  "show  versions <package> :  visible versions of the selected <package>";
2517  help_texts.add () =  "system                  : display the system tag";
2518  help_texts.add () =  "unlock [<p> <v> [<path>]] : unlock a package";
2519  help_texts.add () =  "version                 : version of CMT";
2520  help_texts.add () =  "";
2521
2522  //"build <key>             : build various components :"
2523  //"show <key>              : display various infos on :"
2524
2525  help.add (action_none, help_texts[action_none]);
2526  help.add (action_awk, help_texts[action_awk]);
2527  help.add (action_broadcast, help_texts[action_broadcast]);
2528  help.add (action_build, help_texts[action_build]);
2529  help.add (action_build_constituent_makefile, help_texts[action_build_constituent_makefile]);
2530  help.add (action_build_constituent_config, help_texts[action_build_constituent_config]);
2531  help.add (action_build_constituents_makefile, help_texts[action_build_constituents_makefile]);
2532  help.add (action_build_constituents_config, help_texts[action_build_constituents_config]);
2533  help.add (action_build_broadcast_config, help_texts[action_build_broadcast_config]);
2534  help.add (action_build_dependencies, help_texts[action_build_dependencies]);
2535  help.add (action_build_library_links, help_texts[action_build_library_links]);
2536  help.add (action_build_make_setup, help_texts[action_build_make_setup]);
2537  help.add (action_build_msdev, help_texts[action_build_msdev]);
2538  help.add (action_build_CMT_pacman, help_texts[action_build_CMT_pacman]);
2539  help.add (action_build_vsnet, help_texts[action_build_vsnet]);
2540  help.add (action_build_os9_makefile, help_texts[action_build_os9_makefile]);
2541  help.add (action_build_prototype, help_texts[action_build_prototype]);
2542  help.add (action_build_readme, help_texts[action_build_readme]);
2543  help.add (action_build_tag_makefile, help_texts[action_build_tag_makefile]);
2544  help.add (action_build_temporary_name, help_texts[action_build_temporary_name]);
2545  help.add (action_build_triggers, help_texts[action_build_triggers]);
2546  help.add (action_build_windefs, help_texts[action_build_windefs]);
2547  help.add (action_check_configuration, help_texts[action_check_configuration]);
2548  help.add (action_check_files, help_texts[action_check_files]);
2549  help.add (action_check_version, help_texts[action_check_version]);
2550  help.add (action_checkout, help_texts[action_checkout]);
2551  help.add (action_cleanup, help_texts[action_cleanup]);
2552  help.add (action_config, help_texts[action_config]);
2553  help.add (action_create, help_texts[action_create]);
2554  help.add (action_create_project, help_texts[action_create_project]);
2555  help.add (action_cvsbranches, help_texts[action_cvsbranches]);
2556  help.add (action_cvssubpackages, help_texts[action_cvssubpackages]);
2557  help.add (action_cvssubprojects, help_texts[action_cvssubprojects]);
2558  help.add (action_cvstags, help_texts[action_cvstags]);
2559  help.add (action_do, help_texts[action_do]);
2560  help.add (action_expand_model, help_texts[action_expand_model]);
2561  help.add (action_filter, help_texts[action_filter]);
2562  help.add (action_help, help_texts[action_help]);
2563  help.add (action_load, help_texts[action_load]);
2564  help.add (action_lock, help_texts[action_lock]);
2565  help.add (action_relocate, help_texts[action_relocate]);
2566  help.add (action_remove, help_texts[action_remove]);
2567  help.add (action_remove_library_links, help_texts[action_remove_library_links]);
2568  help.add (action_run, help_texts[action_run]);
2569  help.add (action_run_sequence, help_texts[action_run_sequence]);
2570  help.add (action_set_version, help_texts[action_set_version]);
2571  help.add (action_set_versions, help_texts[action_set_versions]);
2572  help.add (action_setup, help_texts[action_setup]);
2573  help.add (action_show, help_texts[action_show]);
2574  help.add (action_show_action, help_texts[action_show_action]);
2575  help.add (action_show_action_value, help_texts[action_show_action_value]);
2576  help.add (action_show_action_names, help_texts[action_show_action_names]);
2577  help.add (action_show_actions, help_texts[action_show_actions]);
2578  help.add (action_show_all_tags, help_texts[action_show_all_tags]);
2579  help.add (action_show_applied_patterns, help_texts[action_show_applied_patterns]);
2580  help.add (action_show_author, help_texts[action_show_author]);
2581  help.add (action_show_branches, help_texts[action_show_branches]);
2582  help.add (action_show_clients, help_texts[action_show_clients]);
2583  help.add (action_show_cmtpath_patterns, help_texts[action_show_cmtpath_patterns]);
2584  help.add (action_show_constituent, help_texts[action_show_constituent]);
2585  help.add (action_show_constituent_names, help_texts[action_show_constituent_names]);
2586  help.add (action_show_constituents, help_texts[action_show_constituents]);
2587  help.add (action_show_container, help_texts[action_show_container]);
2588  help.add (action_show_cycles, help_texts[action_show_cycles]);
2589  help.add (action_show_fragment, help_texts[action_show_fragment]);
2590  help.add (action_show_fragments, help_texts[action_show_fragments]);
2591  help.add (action_show_groups, help_texts[action_show_groups]);
2592  help.add (action_show_include_dirs, help_texts[action_show_include_dirs]);
2593  help.add (action_show_language, help_texts[action_show_language]);
2594  help.add (action_show_languages, help_texts[action_show_languages]);
2595  help.add (action_show_macro, help_texts[action_show_macro]);
2596  help.add (action_show_macro_value, help_texts[action_show_macro_value]);
2597  help.add (action_show_macro_names, help_texts[action_show_macro_names]);
2598  help.add (action_show_macros, help_texts[action_show_macros]);
2599  help.add (action_show_manager, help_texts[action_show_manager]);
2600  help.add (action_show_packages, help_texts[action_show_packages]);
2601  help.add (action_show_path, help_texts[action_show_path]);
2602  help.add (action_show_pattern, help_texts[action_show_pattern]);
2603  help.add (action_show_pattern_names, help_texts[action_show_pattern_names]);
2604  help.add (action_show_patterns, help_texts[action_show_patterns]);
2605  help.add (action_show_projects, help_texts[action_show_projects]);
2606  help.add (action_show_project_author, help_texts[action_show_project_author]);
2607  help.add (action_show_setup, help_texts[action_show_setup]);
2608  help.add (action_show_pwd, help_texts[action_show_pwd]);
2609  help.add (action_show_set, help_texts[action_show_set]);
2610  help.add (action_show_set_names, help_texts[action_show_set_names]);
2611  help.add (action_show_set_value, help_texts[action_show_set_value]);
2612  help.add (action_show_sets, help_texts[action_show_sets]);
2613  help.add (action_show_strategies, help_texts[action_show_strategies]);
2614  help.add (action_show_tags, help_texts[action_show_tags]);
2615  help.add (action_show_use_paths, help_texts[action_show_use_paths]);
2616  help.add (action_show_uses, help_texts[action_show_uses]);
2617  help.add (action_show_version, help_texts[action_show_version]);
2618  help.add (action_show_versions, help_texts[action_show_versions]);
2619  help.add (action_system, help_texts[action_system]);
2620  help.add (action_unlock, help_texts[action_unlock]);
2621  help.add (action_version, help_texts[action_version]);
2622}
2623
Note: See TracBrowser for help on using the repository browser.