00001 //----------------------------------------------------------- 00002 // Copyright Christian Arnault LAL-Orsay CNRS 00003 // arnault@lal.in2p3.fr 00004 // See the complete license in cmt_license.txt "http://www.cecill.info". 00005 //----------------------------------------------------------- 00006 00007 #ifndef __cmt_commands_h__ 00008 #define __cmt_commands_h__ 00009 00010 #include "cmt_map.h" 00011 #include "cmt.h" 00012 00013 class ArgParser 00014 { 00015 public: 00016 typedef void (ArgParser::* parser) (void); 00017 00018 ArgParser (CmtContext& context); 00019 00020 void parse (); 00021 00022 int argc; 00023 char** argv; 00024 cmt_string arg; 00025 CmtSystem::cmt_string_vector arguments; 00026 cmt_string extra_line; 00027 cmt_string extra_file; 00028 PrintMode mode; 00029 ActionType help_action; 00030 00031 private: 00032 void do_awk (); 00033 void do_broadcast (); 00034 void do_build (); 00035 void do_check (); 00036 void do_check_files (); 00037 void do_checkout (); 00038 void do_cleanup (); 00039 void do_config (); 00040 void do_create (); 00041 void do_create_project (); 00042 void do_cvsbranches (); 00043 void do_cvssubpackages (); 00044 void do_cvssubprojects (); 00045 void do_cvstags (); 00046 void do_do (); 00047 void do_expand (); 00048 void do_filter (); 00049 void do_help (); 00050 void do_lock (); 00051 void do_remove (); 00052 void do_run (); 00053 void do_run_sequence (); 00054 void do_set (); 00055 void do_setup (); 00056 void do_show (); 00057 void do_system (); 00058 void do_unlock (); 00059 void do_version (); 00060 void option_help (); 00061 void option_n (); 00062 void option_quiet (); 00063 void option_csh (); 00064 void option_sh (); 00065 void option_bat (); 00066 void option_use (); 00067 void option_pack (); 00068 void option_version (); 00069 void option_path (); 00070 void option_f (); 00071 void option_e (); 00072 void option_home (); 00073 void option_tag (); 00074 void option_tag_add (); 00075 void option_tag_remove (); 00076 void option_user_context (); 00077 void option_with_version_directory (); 00078 void option_without_version_directory (); 00079 void option_no_cleanup (); 00080 void option_private (); 00081 void option_public (); 00082 00083 void shift (); 00084 void unshift (); 00085 void fill_arguments (); 00086 cmt_string& fill_one_argument (); 00087 cmt_string& fill_one_argument_filtered (); 00088 00089 CmtContext& cmt; 00090 00091 cmt_vmap <cmt_string, int> parsers; 00092 cmt_vector <parser> pv; 00093 00094 }; 00095 00096 class CommandHelp 00097 { 00098 public: 00099 typedef cmt_map <ActionType, cmt_string> HelpMap; 00100 typedef cmt_vector <cmt_string> HelpTexts; 00101 00102 static HelpMap& get_help (); 00103 static HelpTexts& get_help_texts (); 00104 static const cmt_string& get_help_text (ActionType key); 00105 static void show_all (); 00106 static void show (ActionType action); 00107 00108 private: 00109 static CommandHelp& instance (); 00110 00111 CommandHelp (); 00112 00113 HelpMap m_help; 00114 HelpTexts m_help_texts; 00115 }; 00116 00117 #endif