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 | #ifndef __cmt_commands_h__
|
---|
9 | #define __cmt_commands_h__
|
---|
10 |
|
---|
11 | #include "cmt_map.h"
|
---|
12 | #include "cmt.h"
|
---|
13 |
|
---|
14 | class ArgParser
|
---|
15 | {
|
---|
16 | public:
|
---|
17 | typedef void (ArgParser::* parser) (void);
|
---|
18 |
|
---|
19 | ArgParser (CmtContext& context);
|
---|
20 |
|
---|
21 | void parse ();
|
---|
22 |
|
---|
23 | int argc;
|
---|
24 | char** argv;
|
---|
25 | cmt_string arg;
|
---|
26 | CmtSystem::cmt_string_vector arguments;
|
---|
27 | cmt_string extra_line;
|
---|
28 | cmt_string extra_file;
|
---|
29 | PrintMode mode;
|
---|
30 | ActionType help_action;
|
---|
31 |
|
---|
32 | private:
|
---|
33 | void do_awk ();
|
---|
34 | void do_broadcast ();
|
---|
35 | void do_build ();
|
---|
36 | void do_check ();
|
---|
37 | void do_check_files ();
|
---|
38 | void do_checkout ();
|
---|
39 | void do_cleanup ();
|
---|
40 | void do_config ();
|
---|
41 | void do_create ();
|
---|
42 | void do_create_project ();
|
---|
43 | void do_cvsbranches ();
|
---|
44 | void do_cvssubpackages ();
|
---|
45 | void do_cvssubprojects ();
|
---|
46 | void do_cvstags ();
|
---|
47 | void do_do ();
|
---|
48 | void do_expand ();
|
---|
49 | void do_filter ();
|
---|
50 | void do_help ();
|
---|
51 | void do_lock ();
|
---|
52 | void do_relocate ();
|
---|
53 | void do_remove ();
|
---|
54 | void do_run ();
|
---|
55 | void do_run_sequence ();
|
---|
56 | void do_set ();
|
---|
57 | void do_setup ();
|
---|
58 | void do_show ();
|
---|
59 | void do_system ();
|
---|
60 | void do_unlock ();
|
---|
61 | void do_version ();
|
---|
62 | void option_disable_warnings();
|
---|
63 | void option_help ();
|
---|
64 | void option_n ();
|
---|
65 | void option_quiet ();
|
---|
66 | void option_warnings ();
|
---|
67 | void option_csh ();
|
---|
68 | void option_sh ();
|
---|
69 | void option_bat ();
|
---|
70 | void option_use ();
|
---|
71 | void option_pack ();
|
---|
72 | void option_version ();
|
---|
73 | void option_path ();
|
---|
74 | void option_f ();
|
---|
75 | void option_e ();
|
---|
76 | void option_home ();
|
---|
77 | void option_tag ();
|
---|
78 | void option_tag_add ();
|
---|
79 | void option_tag_remove ();
|
---|
80 | void option_user_context ();
|
---|
81 | void option_with_version_directory ();
|
---|
82 | void option_without_version_directory ();
|
---|
83 | void option_no_cleanup ();
|
---|
84 | void option_private ();
|
---|
85 | void option_public ();
|
---|
86 |
|
---|
87 | void shift ();
|
---|
88 | void unshift ();
|
---|
89 | void fill_arguments ();
|
---|
90 | cmt_string& fill_one_argument ();
|
---|
91 | cmt_string& fill_one_argument_filtered ();
|
---|
92 |
|
---|
93 | CmtContext& cmt;
|
---|
94 |
|
---|
95 | cmt_vmap <cmt_string, int> parsers;
|
---|
96 | cmt_vector <parser> pv;
|
---|
97 |
|
---|
98 | };
|
---|
99 |
|
---|
100 | class CommandHelp
|
---|
101 | {
|
---|
102 | public:
|
---|
103 | typedef cmt_map <ActionType, cmt_string> HelpMap;
|
---|
104 | typedef cmt_vector <cmt_string> HelpTexts;
|
---|
105 |
|
---|
106 | static HelpMap& get_help ();
|
---|
107 | static HelpTexts& get_help_texts ();
|
---|
108 | static const cmt_string& get_help_text (ActionType key);
|
---|
109 | static void show_all ();
|
---|
110 | static void show (ActionType action);
|
---|
111 |
|
---|
112 | private:
|
---|
113 | static CommandHelp& instance ();
|
---|
114 |
|
---|
115 | CommandHelp ();
|
---|
116 |
|
---|
117 | HelpMap m_help;
|
---|
118 | HelpTexts m_help_texts;
|
---|
119 | };
|
---|
120 |
|
---|
121 | #endif
|
---|