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