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

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

See C.L. 448

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