[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 | #include "cmt_commands.h" |
---|
| 8 | #include "cmt_tag.h" |
---|
| 9 | #include "cmt_symbol.h" |
---|
| 10 | #include "cmt_project.h" |
---|
| 11 | |
---|
| 12 | ArgParser::ArgParser (CmtContext& context) : cmt(context), argc(0), argv(0), mode(Csh) |
---|
| 13 | { |
---|
| 14 | arguments.clear (); |
---|
| 15 | |
---|
| 16 | int i = 0; |
---|
| 17 | |
---|
| 18 | parsers.add ("awk", i); |
---|
| 19 | pv.push_back (&ArgParser::do_awk); i++; |
---|
| 20 | |
---|
| 21 | parsers.add ("br", i); |
---|
| 22 | parsers.add ("bro", i); |
---|
| 23 | parsers.add ("broa", i); |
---|
| 24 | parsers.add ("broad", i); |
---|
| 25 | parsers.add ("broadc", i); |
---|
| 26 | parsers.add ("broadca", i); |
---|
| 27 | parsers.add ("broadcas", i); |
---|
| 28 | parsers.add ("broadcast", i); |
---|
| 29 | pv.push_back (&ArgParser::do_broadcast); i++; |
---|
| 30 | |
---|
| 31 | parsers.add ("bu", i); |
---|
| 32 | parsers.add ("bui", i); |
---|
| 33 | parsers.add ("buil", i); |
---|
| 34 | parsers.add ("build", i); |
---|
| 35 | pv.push_back (&ArgParser::do_build); i++; |
---|
| 36 | |
---|
| 37 | parsers.add ("check", i); |
---|
| 38 | pv.push_back (&ArgParser::do_check); i++; |
---|
| 39 | |
---|
| 40 | parsers.add ("check_f", i); |
---|
| 41 | parsers.add ("check_fi", i); |
---|
| 42 | parsers.add ("check_fil", i); |
---|
| 43 | parsers.add ("check_file", i); |
---|
| 44 | parsers.add ("check_files", i); |
---|
| 45 | pv.push_back (&ArgParser::do_check_files); i++; |
---|
| 46 | |
---|
| 47 | parsers.add ("co", i); |
---|
| 48 | parsers.add ("checkout", i); |
---|
| 49 | pv.push_back (&ArgParser::do_checkout); i++; |
---|
| 50 | |
---|
| 51 | parsers.add ("cl", i); |
---|
| 52 | parsers.add ("cle", i); |
---|
| 53 | parsers.add ("clea", i); |
---|
| 54 | parsers.add ("clean", i); |
---|
| 55 | parsers.add ("cleanu", i); |
---|
| 56 | parsers.add ("cleanup", i); |
---|
| 57 | pv.push_back (&ArgParser::do_cleanup); i++; |
---|
| 58 | |
---|
| 59 | parsers.add ("con", i); |
---|
| 60 | parsers.add ("conf", i); |
---|
| 61 | parsers.add ("confi", i); |
---|
| 62 | parsers.add ("config", i); |
---|
| 63 | pv.push_back (&ArgParser::do_config); i++; |
---|
| 64 | |
---|
| 65 | parsers.add ("create", i); |
---|
| 66 | pv.push_back (&ArgParser::do_create); i++; |
---|
| 67 | |
---|
| 68 | parsers.add ("create_project", i); |
---|
| 69 | pv.push_back (&ArgParser::do_create_project); i++; |
---|
| 70 | |
---|
| 71 | parsers.add ("cvsb", i); |
---|
| 72 | parsers.add ("cvsbr", i); |
---|
| 73 | parsers.add ("cvsbra", i); |
---|
| 74 | parsers.add ("cvsbran", i); |
---|
| 75 | parsers.add ("cvsbranc", i); |
---|
| 76 | parsers.add ("cvsbranch", i); |
---|
| 77 | parsers.add ("cvsbranche", i); |
---|
| 78 | parsers.add ("cvsbranches", i); |
---|
| 79 | pv.push_back (&ArgParser::do_cvsbranches); i++; |
---|
| 80 | |
---|
| 81 | parsers.add ("cvss", i); |
---|
| 82 | parsers.add ("cvssu", i); |
---|
| 83 | parsers.add ("cvssub", i); |
---|
| 84 | parsers.add ("cvssubp", i); |
---|
| 85 | parsers.add ("cvssubpa", i); |
---|
| 86 | parsers.add ("cvssubpac", i); |
---|
| 87 | parsers.add ("cvssubpack", i); |
---|
| 88 | parsers.add ("cvssubpacka", i); |
---|
| 89 | parsers.add ("cvssubpackag", i); |
---|
| 90 | parsers.add ("cvssubpackage", i); |
---|
| 91 | parsers.add ("cvssubpackages", i); |
---|
| 92 | pv.push_back (&ArgParser::do_cvssubpackages); i++; |
---|
| 93 | |
---|
| 94 | parsers.add ("cvst", i); |
---|
| 95 | parsers.add ("cvsta", i); |
---|
| 96 | parsers.add ("cvstag", i); |
---|
| 97 | parsers.add ("cvstags", i); |
---|
| 98 | pv.push_back (&ArgParser::do_cvstags); i++; |
---|
| 99 | |
---|
| 100 | parsers.add ("d", i); |
---|
| 101 | parsers.add ("do", i); |
---|
| 102 | pv.push_back (&ArgParser::do_do); i++; |
---|
| 103 | |
---|
| 104 | parsers.add ("e", i); |
---|
| 105 | parsers.add ("ex", i); |
---|
| 106 | parsers.add ("exp", i); |
---|
| 107 | parsers.add ("expa", i); |
---|
| 108 | parsers.add ("expan", i); |
---|
| 109 | parsers.add ("expand", i); |
---|
| 110 | pv.push_back (&ArgParser::do_expand); i++; |
---|
| 111 | |
---|
| 112 | parsers.add ("f", i); |
---|
| 113 | parsers.add ("fi", i); |
---|
| 114 | parsers.add ("fil", i); |
---|
| 115 | parsers.add ("filt", i); |
---|
| 116 | parsers.add ("filte", i); |
---|
| 117 | parsers.add ("filter", i); |
---|
| 118 | pv.push_back (&ArgParser::do_filter); i++; |
---|
| 119 | |
---|
| 120 | parsers.add ("h", i); |
---|
| 121 | parsers.add ("he", i); |
---|
| 122 | parsers.add ("hel", i); |
---|
| 123 | parsers.add ("help", i); |
---|
| 124 | pv.push_back (&ArgParser::do_help); i++; |
---|
| 125 | |
---|
| 126 | parsers.add ("l", i); |
---|
| 127 | parsers.add ("lo", i); |
---|
| 128 | parsers.add ("loc", i); |
---|
| 129 | parsers.add ("lock", i); |
---|
| 130 | pv.push_back (&ArgParser::do_lock); i++; |
---|
| 131 | |
---|
| 132 | parsers.add ("re", i); |
---|
| 133 | parsers.add ("rem", i); |
---|
| 134 | parsers.add ("remo", i); |
---|
| 135 | parsers.add ("remov", i); |
---|
| 136 | parsers.add ("remove", i); |
---|
| 137 | pv.push_back (&ArgParser::do_remove); i++; |
---|
| 138 | |
---|
| 139 | parsers.add ("run", i); |
---|
| 140 | pv.push_back (&ArgParser::do_run); i++; |
---|
| 141 | |
---|
| 142 | parsers.add ("run_sequence", i); |
---|
| 143 | pv.push_back (&ArgParser::do_run_sequence); i++; |
---|
| 144 | |
---|
| 145 | parsers.add ("set", i); |
---|
| 146 | pv.push_back (&ArgParser::do_set); i++; |
---|
| 147 | |
---|
| 148 | parsers.add ("setup", i); |
---|
| 149 | pv.push_back (&ArgParser::do_setup); i++; |
---|
| 150 | |
---|
| 151 | parsers.add ("sh", i); |
---|
| 152 | parsers.add ("sho", i); |
---|
| 153 | parsers.add ("show", i); |
---|
| 154 | pv.push_back (&ArgParser::do_show); i++; |
---|
| 155 | |
---|
| 156 | parsers.add ("sy", i); |
---|
| 157 | parsers.add ("sys", i); |
---|
| 158 | parsers.add ("syst", i); |
---|
| 159 | parsers.add ("syste", i); |
---|
| 160 | parsers.add ("system", i); |
---|
| 161 | pv.push_back (&ArgParser::do_system); i++; |
---|
| 162 | |
---|
| 163 | parsers.add ("u", i); |
---|
| 164 | parsers.add ("un", i); |
---|
| 165 | parsers.add ("unl", i); |
---|
| 166 | parsers.add ("unlo", i); |
---|
| 167 | parsers.add ("unloc", i); |
---|
| 168 | parsers.add ("unlock", i); |
---|
| 169 | pv.push_back (&ArgParser::do_unlock); i++; |
---|
| 170 | |
---|
| 171 | parsers.add ("v", i); |
---|
| 172 | parsers.add ("ve", i); |
---|
| 173 | parsers.add ("ver", i); |
---|
| 174 | parsers.add ("vers", i); |
---|
| 175 | parsers.add ("versi", i); |
---|
| 176 | parsers.add ("versio", i); |
---|
| 177 | parsers.add ("version", i); |
---|
| 178 | parsers.add ("--version", i); |
---|
| 179 | pv.push_back (&ArgParser::do_version); i++; |
---|
| 180 | |
---|
| 181 | parsers.add ("+p", i); |
---|
| 182 | parsers.add ("+pa", i); |
---|
| 183 | parsers.add ("+pat", i); |
---|
| 184 | parsers.add ("+path", i); |
---|
| 185 | pv.push_back (&ArgParser::do_add_path); i++; |
---|
| 186 | |
---|
| 187 | parsers.add ("-b", i); |
---|
| 188 | parsers.add ("-ba", i); |
---|
| 189 | parsers.add ("-bat", i); |
---|
| 190 | pv.push_back (&ArgParser::option_bat); i++; |
---|
| 191 | |
---|
| 192 | parsers.add ("-c", i); |
---|
| 193 | parsers.add ("-cs", i); |
---|
| 194 | parsers.add ("-csh", i); |
---|
| 195 | pv.push_back (&ArgParser::option_csh); i++; |
---|
| 196 | |
---|
| 197 | parsers.add ("-e", i); |
---|
| 198 | pv.push_back (&ArgParser::option_e); i++; |
---|
| 199 | |
---|
| 200 | parsers.add ("-f", i); |
---|
| 201 | pv.push_back (&ArgParser::option_f); i++; |
---|
| 202 | |
---|
| 203 | parsers.add ("-h", i); |
---|
| 204 | parsers.add ("-he", i); |
---|
| 205 | parsers.add ("-hel", i); |
---|
| 206 | parsers.add ("-help", i); |
---|
| 207 | parsers.add ("--h", i); |
---|
| 208 | parsers.add ("--he", i); |
---|
| 209 | parsers.add ("--hel", i); |
---|
| 210 | parsers.add ("--help", i); |
---|
| 211 | pv.push_back (&ArgParser::option_help); i++; |
---|
| 212 | |
---|
| 213 | parsers.add ("-ho", i); |
---|
| 214 | parsers.add ("-hom", i); |
---|
| 215 | parsers.add ("-home", i); |
---|
| 216 | pv.push_back (&ArgParser::option_home); i++; |
---|
| 217 | |
---|
| 218 | parsers.add ("-n", i); |
---|
| 219 | pv.push_back (&ArgParser::option_n); i++; |
---|
| 220 | |
---|
| 221 | parsers.add ("-no_c", i); |
---|
| 222 | parsers.add ("-no_cl", i); |
---|
| 223 | parsers.add ("-no_cle", i); |
---|
| 224 | parsers.add ("-no_clea", i); |
---|
| 225 | parsers.add ("-no_clean", i); |
---|
| 226 | parsers.add ("-no_cleanu", i); |
---|
| 227 | parsers.add ("-no_cleanup", i); |
---|
| 228 | pv.push_back (&ArgParser::option_no_cleanup); i++; |
---|
| 229 | |
---|
| 230 | parsers.add ("-pac", i); |
---|
| 231 | parsers.add ("-pack", i); |
---|
| 232 | pv.push_back (&ArgParser::option_pack); i++; |
---|
| 233 | |
---|
| 234 | parsers.add ("-pat", i); |
---|
| 235 | parsers.add ("-path", i); |
---|
| 236 | pv.push_back (&ArgParser::option_path); i++; |
---|
| 237 | |
---|
| 238 | parsers.add ("-pr", i); |
---|
| 239 | parsers.add ("-pri", i); |
---|
| 240 | parsers.add ("-priv", i); |
---|
| 241 | parsers.add ("-priva", i); |
---|
| 242 | parsers.add ("-privat", i); |
---|
| 243 | parsers.add ("-private", i); |
---|
| 244 | pv.push_back (&ArgParser::option_private); i++; |
---|
| 245 | |
---|
| 246 | parsers.add ("-pu", i); |
---|
| 247 | parsers.add ("-pub", i); |
---|
| 248 | parsers.add ("-publ", i); |
---|
| 249 | parsers.add ("-publi", i); |
---|
| 250 | parsers.add ("-public", i); |
---|
| 251 | pv.push_back (&ArgParser::option_public); i++; |
---|
| 252 | |
---|
| 253 | parsers.add ("-s", i); |
---|
| 254 | parsers.add ("-sh", i); |
---|
| 255 | pv.push_back (&ArgParser::option_sh); i++; |
---|
| 256 | |
---|
| 257 | parsers.add ("-q", i); |
---|
| 258 | parsers.add ("-qu", i); |
---|
| 259 | parsers.add ("-qui", i); |
---|
| 260 | parsers.add ("-quie", i); |
---|
| 261 | parsers.add ("-quiet", i); |
---|
| 262 | pv.push_back (&ArgParser::option_quiet); i++; |
---|
| 263 | |
---|
| 264 | parsers.add ("-tag", i); |
---|
| 265 | pv.push_back (&ArgParser::option_tag); i++; |
---|
| 266 | |
---|
| 267 | parsers.add ("-tag_add", i); |
---|
| 268 | pv.push_back (&ArgParser::option_tag_add); i++; |
---|
| 269 | |
---|
| 270 | parsers.add ("-tag_remove", i); |
---|
| 271 | pv.push_back (&ArgParser::option_tag_remove); i++; |
---|
| 272 | |
---|
| 273 | parsers.add ("-u", i); |
---|
| 274 | parsers.add ("-us", i); |
---|
| 275 | parsers.add ("-use", i); |
---|
| 276 | pv.push_back (&ArgParser::option_use); i++; |
---|
| 277 | |
---|
| 278 | parsers.add ("-user", i); |
---|
| 279 | parsers.add ("-user_", i); |
---|
| 280 | parsers.add ("-user_c", i); |
---|
| 281 | parsers.add ("-user_co", i); |
---|
| 282 | parsers.add ("-user_con", i); |
---|
| 283 | parsers.add ("-user_cont", i); |
---|
| 284 | parsers.add ("-user_conte", i); |
---|
| 285 | parsers.add ("-user_contex", i); |
---|
| 286 | parsers.add ("-user_context", i); |
---|
| 287 | pv.push_back (&ArgParser::option_user_context); i++; |
---|
| 288 | |
---|
| 289 | parsers.add ("-v", i); |
---|
| 290 | parsers.add ("-ve", i); |
---|
| 291 | parsers.add ("-ver", i); |
---|
| 292 | parsers.add ("-vers", i); |
---|
| 293 | parsers.add ("-versi", i); |
---|
| 294 | parsers.add ("-versio", i); |
---|
| 295 | parsers.add ("-version", i); |
---|
| 296 | pv.push_back (&ArgParser::option_version); i++; |
---|
| 297 | |
---|
| 298 | parsers.add ("-with_v", i); |
---|
| 299 | parsers.add ("-with_ve", i); |
---|
| 300 | parsers.add ("-with_ver", i); |
---|
| 301 | parsers.add ("-with_vers", i); |
---|
| 302 | parsers.add ("-with_versi", i); |
---|
| 303 | parsers.add ("-with_versio", i); |
---|
| 304 | parsers.add ("-with_version", i); |
---|
| 305 | parsers.add ("-with_version_", i); |
---|
| 306 | parsers.add ("-with_version_d", i); |
---|
| 307 | parsers.add ("-with_version_di", i); |
---|
| 308 | parsers.add ("-with_version_dir", i); |
---|
| 309 | parsers.add ("-with_version_dire", i); |
---|
| 310 | parsers.add ("-with_version_direc", i); |
---|
| 311 | parsers.add ("-with_version_direct", i); |
---|
| 312 | parsers.add ("-with_version_directo", i); |
---|
| 313 | parsers.add ("-with_version_director", i); |
---|
| 314 | parsers.add ("-with_version_directory", i); |
---|
| 315 | pv.push_back (&ArgParser::option_with_version_directory); i++; |
---|
| 316 | |
---|
| 317 | parsers.add ("-without_v", i); |
---|
| 318 | parsers.add ("-without_ve", i); |
---|
| 319 | parsers.add ("-without_ver", i); |
---|
| 320 | parsers.add ("-without_vers", i); |
---|
| 321 | parsers.add ("-without_versi", i); |
---|
| 322 | parsers.add ("-without_versio", i); |
---|
| 323 | parsers.add ("-without_version", i); |
---|
| 324 | parsers.add ("-without_version_", i); |
---|
| 325 | parsers.add ("-without_version_d", i); |
---|
| 326 | parsers.add ("-without_version_di", i); |
---|
| 327 | parsers.add ("-without_version_dir", i); |
---|
| 328 | parsers.add ("-without_version_dire", i); |
---|
| 329 | parsers.add ("-without_version_direc", i); |
---|
| 330 | parsers.add ("-without_version_direct", i); |
---|
| 331 | parsers.add ("-without_version_directo", i); |
---|
| 332 | parsers.add ("-without_version_director", i); |
---|
| 333 | parsers.add ("-without_version_directory", i); |
---|
| 334 | pv.push_back (&ArgParser::option_without_version_directory); i++; |
---|
| 335 | |
---|
| 336 | } |
---|
| 337 | |
---|
| 338 | void ArgParser::shift () |
---|
| 339 | { |
---|
| 340 | if (argc > 0) |
---|
| 341 | { |
---|
| 342 | argc--; |
---|
| 343 | argv++; |
---|
| 344 | } |
---|
| 345 | } |
---|
| 346 | |
---|
| 347 | void ArgParser::unshift () |
---|
| 348 | { |
---|
| 349 | argc++; |
---|
| 350 | argv--; |
---|
| 351 | } |
---|
| 352 | |
---|
| 353 | void ArgParser::fill_arguments () |
---|
| 354 | { |
---|
| 355 | while (argc > 0) |
---|
| 356 | { |
---|
| 357 | cmt_string& s = arguments.add (); |
---|
| 358 | s = argv[0]; |
---|
| 359 | |
---|
| 360 | //cerr << "Getting arg[" << s << "] " << endl; |
---|
| 361 | |
---|
| 362 | shift (); |
---|
| 363 | } |
---|
| 364 | } |
---|
| 365 | |
---|
| 366 | cmt_string& ArgParser::fill_one_argument () |
---|
| 367 | { |
---|
| 368 | if (argc > 0) |
---|
| 369 | { |
---|
| 370 | cmt_string& s = arguments.add (); |
---|
| 371 | s = argv[0]; |
---|
| 372 | |
---|
| 373 | //cerr << "Getting arg[" << s << "] " << endl; |
---|
| 374 | |
---|
| 375 | shift (); |
---|
| 376 | |
---|
| 377 | return (s); |
---|
| 378 | } |
---|
| 379 | else |
---|
| 380 | { |
---|
| 381 | static cmt_string empty = ""; |
---|
| 382 | return (empty); |
---|
| 383 | } |
---|
| 384 | } |
---|
| 385 | |
---|
| 386 | cmt_string& ArgParser::fill_one_argument_filtered () |
---|
| 387 | { |
---|
| 388 | if (argc > 0) |
---|
| 389 | { |
---|
| 390 | cmt_string& s = arguments.add (); |
---|
| 391 | s = argv[0]; |
---|
| 392 | |
---|
| 393 | if (s[0] == '-') |
---|
| 394 | { |
---|
| 395 | s = ""; |
---|
| 396 | } |
---|
| 397 | |
---|
| 398 | //cerr << "Getting arg[" << s << "] " << endl; |
---|
| 399 | |
---|
| 400 | shift (); |
---|
| 401 | |
---|
| 402 | return (s); |
---|
| 403 | } |
---|
| 404 | else |
---|
| 405 | { |
---|
| 406 | static cmt_string empty = ""; |
---|
| 407 | return (empty); |
---|
| 408 | } |
---|
| 409 | } |
---|
| 410 | |
---|
| 411 | void ArgParser::parse () |
---|
| 412 | { |
---|
| 413 | ArgParser& me = *this; |
---|
| 414 | |
---|
| 415 | help_action = action_none; |
---|
| 416 | arguments.clear (); |
---|
| 417 | extra_line.erase (0); |
---|
| 418 | extra_file.erase (0); |
---|
| 419 | mode = Csh; |
---|
| 420 | |
---|
| 421 | /// Skip first argument ("cmt") |
---|
| 422 | shift (); |
---|
| 423 | |
---|
| 424 | while (argc > 0) |
---|
| 425 | { |
---|
| 426 | arg = argv[0]; |
---|
| 427 | |
---|
| 428 | shift (); |
---|
| 429 | |
---|
| 430 | /// Suppress trailing carriage-return |
---|
| 431 | int cr = arg.find ('\r'); |
---|
| 432 | if (cr != cmt_string::npos) arg.erase (cr); |
---|
| 433 | |
---|
| 434 | /// Suppress enclosing quotes |
---|
| 435 | if ((arg[0] == '\"') && (arg[arg.size () - 1] == '\"')) |
---|
| 436 | { |
---|
| 437 | arg.erase (0, 1); |
---|
| 438 | arg.erase (arg.size () - 1, 1); |
---|
| 439 | } |
---|
| 440 | |
---|
| 441 | /// Detect and split arguments of the form a=b |
---|
| 442 | /// left and right part of this argument |
---|
| 443 | cmt_string reduced_arg = arg; |
---|
| 444 | int pos = reduced_arg.find ('='); |
---|
| 445 | if (pos != cmt_string::npos) |
---|
| 446 | { |
---|
| 447 | reduced_arg.erase (pos); |
---|
| 448 | arg.erase (0, pos+1); |
---|
| 449 | } |
---|
| 450 | else |
---|
| 451 | { |
---|
| 452 | arg = ""; |
---|
| 453 | } |
---|
| 454 | |
---|
| 455 | //cerr << "argc=" << argc << " reduced_arg=[" << reduced_arg << "] arg=[" << arg << "]" << endl; |
---|
| 456 | |
---|
| 457 | if (parsers.has (reduced_arg)) |
---|
| 458 | { |
---|
| 459 | int i = (*parsers.find (reduced_arg)); |
---|
| 460 | |
---|
| 461 | parser p = pv[i]; |
---|
| 462 | (me.*p) (); |
---|
| 463 | } |
---|
| 464 | else |
---|
| 465 | { |
---|
| 466 | unshift (); |
---|
| 467 | do_do (); |
---|
| 468 | |
---|
| 469 | /* |
---|
| 470 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad command parameter " << arg << endl; |
---|
| 471 | help_action = action_none; |
---|
| 472 | */ |
---|
| 473 | } |
---|
| 474 | } |
---|
| 475 | } |
---|
| 476 | |
---|
| 477 | void ArgParser::do_awk () |
---|
| 478 | { |
---|
| 479 | fill_arguments (); |
---|
| 480 | cmt.m_action = action_awk; |
---|
| 481 | } |
---|
| 482 | |
---|
| 483 | void ArgParser::do_broadcast () |
---|
| 484 | { |
---|
| 485 | fill_arguments (); |
---|
| 486 | cmt.m_action = action_broadcast; |
---|
| 487 | |
---|
| 488 | if (cmt.m_scope_filtering_mode == default_filtering_mode) |
---|
| 489 | { |
---|
| 490 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 491 | } |
---|
| 492 | } |
---|
| 493 | |
---|
| 494 | void ArgParser::do_build () |
---|
| 495 | { |
---|
| 496 | if (argc > 0) |
---|
| 497 | { |
---|
| 498 | arg = argv[0]; |
---|
| 499 | |
---|
| 500 | if (arg == "-nmake") |
---|
| 501 | { |
---|
| 502 | cmt.m_build_nmake = true; |
---|
| 503 | shift (); |
---|
| 504 | } |
---|
| 505 | } |
---|
| 506 | |
---|
| 507 | if (argc > 0) |
---|
| 508 | { |
---|
| 509 | arg = argv[0]; |
---|
| 510 | |
---|
| 511 | shift (); |
---|
| 512 | |
---|
| 513 | if (arg == "constituent_makefile") |
---|
| 514 | { |
---|
| 515 | if (argc > 0) |
---|
| 516 | { |
---|
| 517 | fill_one_argument (); |
---|
| 518 | cmt.m_action = action_build_constituent_makefile; |
---|
| 519 | } |
---|
| 520 | else |
---|
| 521 | { |
---|
| 522 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : constituent name missing" << endl; |
---|
| 523 | cmt.m_action = action_build_constituent_makefile; |
---|
| 524 | help_action = action_help; |
---|
| 525 | } |
---|
| 526 | } |
---|
| 527 | else if (arg == "constituents_makefile") |
---|
| 528 | { |
---|
| 529 | fill_arguments (); |
---|
| 530 | cmt.m_action = action_build_constituents_makefile; |
---|
| 531 | } |
---|
| 532 | else if (arg == "dependencies") |
---|
| 533 | { |
---|
| 534 | if (argc > 0) |
---|
| 535 | { |
---|
| 536 | fill_arguments (); |
---|
| 537 | cmt.m_action = action_build_dependencies; |
---|
| 538 | } |
---|
| 539 | else |
---|
| 540 | { |
---|
| 541 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing " << endl; |
---|
| 542 | help_action = action_help; |
---|
| 543 | cmt.m_action = action_build_dependencies; |
---|
| 544 | } |
---|
| 545 | } |
---|
| 546 | else if (arg == "library_links") |
---|
| 547 | { |
---|
| 548 | cmt.m_action = action_build_library_links; |
---|
| 549 | } |
---|
| 550 | else if (arg == "make_setup") |
---|
| 551 | { |
---|
| 552 | cmt.m_action = action_build_make_setup; |
---|
| 553 | } |
---|
| 554 | else if (arg == "msdev") |
---|
| 555 | { |
---|
| 556 | if (argc > 0) |
---|
| 557 | { |
---|
| 558 | fill_one_argument_filtered (); |
---|
| 559 | } |
---|
| 560 | |
---|
| 561 | cmt.m_action = action_build_msdev; |
---|
| 562 | } |
---|
| 563 | else if (arg == "CMT_pacman") |
---|
| 564 | { |
---|
| 565 | cmt.m_action = action_build_CMT_pacman; |
---|
| 566 | } |
---|
| 567 | else if (arg == "vsnet") |
---|
| 568 | { |
---|
| 569 | if (argc > 0) |
---|
| 570 | { |
---|
| 571 | fill_one_argument_filtered (); |
---|
| 572 | } |
---|
| 573 | |
---|
| 574 | cmt.m_action = action_build_vsnet; |
---|
| 575 | } |
---|
| 576 | else if (arg == "os9_makefile") |
---|
| 577 | { |
---|
| 578 | if (argc > 0) |
---|
| 579 | { |
---|
| 580 | fill_one_argument (); |
---|
| 581 | cmt.m_action = action_build_os9_makefile; |
---|
| 582 | } |
---|
| 583 | else |
---|
| 584 | { |
---|
| 585 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing " << endl; |
---|
| 586 | help_action = action_help; |
---|
| 587 | cmt.m_action = action_build_os9_makefile; |
---|
| 588 | } |
---|
| 589 | } |
---|
| 590 | else if (arg == "prototype") |
---|
| 591 | { |
---|
| 592 | if (argc > 0) |
---|
| 593 | { |
---|
| 594 | fill_one_argument (); |
---|
| 595 | cmt.m_action = action_build_prototype; |
---|
| 596 | } |
---|
| 597 | else |
---|
| 598 | { |
---|
| 599 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl; |
---|
| 600 | help_action = action_help; |
---|
| 601 | cmt.m_action = action_build_prototype; |
---|
| 602 | } |
---|
| 603 | } |
---|
| 604 | else if (arg == "readme") |
---|
| 605 | { |
---|
| 606 | cmt.m_action = action_build_readme; |
---|
| 607 | |
---|
| 608 | fill_arguments (); |
---|
| 609 | } |
---|
| 610 | else if (arg == "tag_makefile") |
---|
| 611 | { |
---|
| 612 | cmt.m_action = action_build_tag_makefile; |
---|
| 613 | } |
---|
| 614 | else if (arg == "temporary_name") |
---|
| 615 | { |
---|
| 616 | cmt.m_action = action_build_temporary_name; |
---|
| 617 | } |
---|
| 618 | else if (arg == "triggers") |
---|
| 619 | { |
---|
| 620 | if (argc > 0) |
---|
| 621 | { |
---|
| 622 | fill_one_argument (); |
---|
| 623 | cmt.m_action = action_build_triggers; |
---|
| 624 | } |
---|
| 625 | else |
---|
| 626 | { |
---|
| 627 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl; |
---|
| 628 | help_action = action_help; |
---|
| 629 | cmt.m_action = action_build_triggers; |
---|
| 630 | } |
---|
| 631 | } |
---|
| 632 | else if (arg == "windefs") |
---|
| 633 | { |
---|
| 634 | if (argc > 0) |
---|
| 635 | { |
---|
| 636 | fill_one_argument (); |
---|
| 637 | cmt.m_action = action_build_windefs; |
---|
| 638 | } |
---|
| 639 | else |
---|
| 640 | { |
---|
| 641 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl; |
---|
| 642 | help_action = action_help; |
---|
| 643 | cmt.m_action = action_build_windefs; |
---|
| 644 | } |
---|
| 645 | } |
---|
| 646 | else |
---|
| 647 | { |
---|
| 648 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : wrong build argument" << endl; |
---|
| 649 | help_action = action_help; |
---|
| 650 | cmt.m_action = action_build; |
---|
| 651 | } |
---|
| 652 | } |
---|
| 653 | else |
---|
| 654 | { |
---|
| 655 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to build" << endl; |
---|
| 656 | help_action = action_help; |
---|
| 657 | cmt.m_action = action_build; |
---|
| 658 | } |
---|
| 659 | } |
---|
| 660 | |
---|
| 661 | void ArgParser::do_check () |
---|
| 662 | { |
---|
| 663 | if (argc > 0) |
---|
| 664 | { |
---|
| 665 | arg = argv[0]; |
---|
| 666 | |
---|
| 667 | shift (); |
---|
| 668 | |
---|
| 669 | if (arg == "configuration") |
---|
| 670 | { |
---|
| 671 | cmt.m_action = action_check_configuration; |
---|
| 672 | } |
---|
| 673 | else if (arg == "files") |
---|
| 674 | { |
---|
| 675 | if (argc > 0) |
---|
| 676 | { |
---|
| 677 | fill_one_argument (); |
---|
| 678 | if (argc > 0) |
---|
| 679 | { |
---|
| 680 | fill_one_argument (); |
---|
| 681 | cmt.m_action = action_check_files; |
---|
| 682 | } |
---|
| 683 | else |
---|
| 684 | { |
---|
| 685 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : reference file name missing" |
---|
| 686 | << endl; |
---|
| 687 | help_action = action_help; |
---|
| 688 | cmt.m_action = action_check_files; |
---|
| 689 | } |
---|
| 690 | } |
---|
| 691 | else |
---|
| 692 | { |
---|
| 693 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : file name missing" << endl; |
---|
| 694 | help_action = action_help; |
---|
| 695 | cmt.m_action = action_check_files; |
---|
| 696 | } |
---|
| 697 | } |
---|
| 698 | else if (arg == "version") |
---|
| 699 | { |
---|
| 700 | if (argc > 0) |
---|
| 701 | { |
---|
| 702 | fill_one_argument (); |
---|
| 703 | cmt.m_action = action_check_version; |
---|
| 704 | } |
---|
| 705 | else |
---|
| 706 | { |
---|
| 707 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : package name missing" << endl; |
---|
| 708 | help_action = action_help; |
---|
| 709 | cmt.m_action = action_check_version; |
---|
| 710 | } |
---|
| 711 | } |
---|
| 712 | else |
---|
| 713 | { |
---|
| 714 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad check option" << endl; |
---|
| 715 | help_action = action_help; |
---|
| 716 | cmt.m_action = action_check; |
---|
| 717 | } |
---|
| 718 | } |
---|
| 719 | else |
---|
| 720 | { |
---|
| 721 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to check" << endl; |
---|
| 722 | help_action = action_help; |
---|
| 723 | cmt.m_action = action_check; |
---|
| 724 | } |
---|
| 725 | } |
---|
| 726 | |
---|
| 727 | void ArgParser::do_check_files () |
---|
| 728 | { |
---|
| 729 | if (argc > 0) |
---|
| 730 | { |
---|
| 731 | fill_one_argument (); |
---|
| 732 | if (argc > 0) |
---|
| 733 | { |
---|
| 734 | fill_one_argument (); |
---|
| 735 | cmt.m_action = action_check_files; |
---|
| 736 | } |
---|
| 737 | else |
---|
| 738 | { |
---|
| 739 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : reference file missing" << endl; |
---|
| 740 | help_action = action_help; |
---|
| 741 | cmt.m_action = action_check_files; |
---|
| 742 | } |
---|
| 743 | } |
---|
| 744 | else |
---|
| 745 | { |
---|
| 746 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : file name missing" << endl; |
---|
| 747 | help_action = action_help; |
---|
| 748 | cmt.m_action = action_check_files; |
---|
| 749 | } |
---|
| 750 | } |
---|
| 751 | |
---|
| 752 | void ArgParser::do_checkout () |
---|
| 753 | { |
---|
| 754 | if (argc > 0) |
---|
| 755 | { |
---|
| 756 | fill_arguments (); |
---|
| 757 | cmt.m_action = action_checkout; |
---|
| 758 | } |
---|
| 759 | else |
---|
| 760 | { |
---|
| 761 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : checkout arguments missing" << endl; |
---|
| 762 | help_action = action_help; |
---|
| 763 | cmt.m_action = action_checkout; |
---|
| 764 | } |
---|
| 765 | } |
---|
| 766 | |
---|
| 767 | void ArgParser::do_cleanup () |
---|
| 768 | { |
---|
| 769 | cmt.m_action = action_cleanup; |
---|
| 770 | } |
---|
| 771 | |
---|
| 772 | void ArgParser::do_config () |
---|
| 773 | { |
---|
| 774 | cmt.m_action = action_config; |
---|
| 775 | } |
---|
| 776 | |
---|
| 777 | void ArgParser::do_create () |
---|
| 778 | { |
---|
| 779 | if (argc > 0) |
---|
| 780 | { |
---|
| 781 | fill_arguments (); |
---|
| 782 | cmt.m_action = action_create; |
---|
| 783 | } |
---|
| 784 | else |
---|
| 785 | { |
---|
| 786 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : create arguments missing" << endl; |
---|
| 787 | help_action = action_help; |
---|
| 788 | cmt.m_action = action_create; |
---|
| 789 | } |
---|
| 790 | } |
---|
| 791 | |
---|
| 792 | void ArgParser::do_create_project () |
---|
| 793 | { |
---|
| 794 | if (argc > 0) |
---|
| 795 | { |
---|
| 796 | fill_arguments (); |
---|
| 797 | cmt.m_action = action_create_project; |
---|
| 798 | } |
---|
| 799 | else |
---|
| 800 | { |
---|
| 801 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : create_project arguments missing" << endl; |
---|
| 802 | help_action = action_help; |
---|
| 803 | cmt.m_action = action_create_project; |
---|
| 804 | } |
---|
| 805 | } |
---|
| 806 | |
---|
| 807 | void ArgParser::do_cvsbranches () |
---|
| 808 | { |
---|
| 809 | if (argc > 0) |
---|
| 810 | { |
---|
| 811 | fill_one_argument (); |
---|
| 812 | cmt.m_action = action_cvsbranches; |
---|
| 813 | } |
---|
| 814 | else |
---|
| 815 | { |
---|
| 816 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : cvsbranches arguments missing" << endl; |
---|
| 817 | help_action = action_help; |
---|
| 818 | cmt.m_action = action_cvsbranches; |
---|
| 819 | } |
---|
| 820 | } |
---|
| 821 | |
---|
| 822 | void ArgParser::do_cvssubpackages () |
---|
| 823 | { |
---|
| 824 | if (argc > 1) |
---|
| 825 | { |
---|
| 826 | fill_one_argument (); |
---|
| 827 | cmt.m_action = action_cvssubpackages; |
---|
| 828 | } |
---|
| 829 | else |
---|
| 830 | { |
---|
| 831 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : cvssubpackages arguments missing" << endl; |
---|
| 832 | help_action = action_help; |
---|
| 833 | cmt.m_action = action_cvssubpackages; |
---|
| 834 | } |
---|
| 835 | } |
---|
| 836 | |
---|
| 837 | void ArgParser::do_cvstags () |
---|
| 838 | { |
---|
| 839 | if (argc > 1) |
---|
| 840 | { |
---|
| 841 | fill_arguments (); |
---|
| 842 | cmt.m_action = action_cvstags; |
---|
| 843 | } |
---|
| 844 | else |
---|
| 845 | { |
---|
| 846 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : package name missing" << endl; |
---|
| 847 | help_action = action_help; |
---|
| 848 | cmt.m_action = action_cvstags; |
---|
| 849 | } |
---|
| 850 | } |
---|
| 851 | |
---|
| 852 | void ArgParser::do_do () |
---|
| 853 | { |
---|
| 854 | if (argc > 0) |
---|
| 855 | { |
---|
| 856 | fill_arguments (); |
---|
| 857 | |
---|
| 858 | { |
---|
| 859 | cmt_string tag_name = "target_"; |
---|
| 860 | tag_name += arguments[0]; |
---|
| 861 | |
---|
| 862 | Tag* tag; |
---|
| 863 | tag = Tag::add (tag_name, PriorityUserTag, "action", 0); |
---|
| 864 | tag->mark (); |
---|
| 865 | } |
---|
| 866 | |
---|
| 867 | cmt.m_action = action_do; |
---|
| 868 | } |
---|
| 869 | else |
---|
| 870 | { |
---|
| 871 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : action not specified" << endl; |
---|
| 872 | help_action = action_help; |
---|
| 873 | cmt.m_action = action_do; |
---|
| 874 | } |
---|
| 875 | } |
---|
| 876 | |
---|
| 877 | void ArgParser::do_expand () |
---|
| 878 | { |
---|
| 879 | if (argc > 0) |
---|
| 880 | { |
---|
| 881 | arg = argv[0]; |
---|
| 882 | |
---|
| 883 | shift (); |
---|
| 884 | if (arg == "model") |
---|
| 885 | { |
---|
| 886 | if (argc > 0) |
---|
| 887 | { |
---|
| 888 | fill_arguments (); |
---|
| 889 | cmt.m_action = action_expand_model; |
---|
| 890 | } |
---|
| 891 | else |
---|
| 892 | { |
---|
| 893 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : model not specified" << endl; |
---|
| 894 | help_action = action_help; |
---|
| 895 | cmt.m_action = action_expand_model; |
---|
| 896 | } |
---|
| 897 | } |
---|
| 898 | else |
---|
| 899 | { |
---|
| 900 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad expand option" << endl; |
---|
| 901 | help_action = action_help; |
---|
| 902 | cmt.m_action = action_expand_model; |
---|
| 903 | } |
---|
| 904 | } |
---|
| 905 | else |
---|
| 906 | { |
---|
| 907 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to expand" << endl; |
---|
| 908 | help_action = action_help; |
---|
| 909 | cmt.m_action = action_expand_model; |
---|
| 910 | } |
---|
| 911 | } |
---|
| 912 | |
---|
| 913 | void ArgParser::do_filter () |
---|
| 914 | { |
---|
| 915 | cmt.m_action = action_filter; |
---|
| 916 | } |
---|
| 917 | |
---|
| 918 | void ArgParser::do_help () |
---|
| 919 | { |
---|
| 920 | help_action = action_help; |
---|
| 921 | } |
---|
| 922 | |
---|
| 923 | void ArgParser::do_lock () |
---|
| 924 | { |
---|
| 925 | if (argc > 0) |
---|
| 926 | { |
---|
| 927 | cmt.m_current_package = fill_one_argument (); |
---|
| 928 | cmt.m_current_version.erase (0); |
---|
| 929 | cmt.m_current_path.erase (0); |
---|
| 930 | |
---|
| 931 | if (argc > 0) |
---|
| 932 | { |
---|
| 933 | cmt.m_current_version = fill_one_argument (); |
---|
| 934 | cmt.m_action = action_lock; |
---|
| 935 | |
---|
| 936 | if (argc > 0) |
---|
| 937 | { |
---|
| 938 | cmt.m_current_path = fill_one_argument_filtered (); |
---|
| 939 | } |
---|
| 940 | |
---|
| 941 | cmt.m_current_access = UserMode; |
---|
| 942 | (Use::current()).set (cmt.m_current_package, |
---|
| 943 | cmt.m_current_version, |
---|
| 944 | cmt.m_current_path); |
---|
| 945 | |
---|
| 946 | } |
---|
| 947 | else |
---|
| 948 | { |
---|
| 949 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : version missing" << endl; |
---|
| 950 | help_action = action_help; |
---|
| 951 | cmt.m_action = action_lock; |
---|
| 952 | } |
---|
| 953 | } |
---|
| 954 | else |
---|
| 955 | { |
---|
| 956 | cmt.m_action = action_lock; |
---|
| 957 | } |
---|
| 958 | } |
---|
| 959 | |
---|
| 960 | void ArgParser::do_remove () |
---|
| 961 | { |
---|
| 962 | if (argc > 0) |
---|
| 963 | { |
---|
| 964 | arg = argv[0]; |
---|
| 965 | |
---|
| 966 | if (arg == "library_links") |
---|
| 967 | { |
---|
| 968 | shift (); |
---|
| 969 | cmt.m_action = action_remove_library_links; |
---|
| 970 | } |
---|
| 971 | else |
---|
| 972 | { |
---|
| 973 | cmt.m_current_package = fill_one_argument (); |
---|
| 974 | cmt.m_current_version.erase (0); |
---|
| 975 | cmt.m_current_path.erase (0); |
---|
| 976 | |
---|
| 977 | if (argc > 0) |
---|
| 978 | { |
---|
| 979 | cmt.m_current_version = fill_one_argument (); |
---|
| 980 | |
---|
| 981 | if (argc > 0) |
---|
| 982 | { |
---|
| 983 | cmt.m_current_path = fill_one_argument_filtered (); |
---|
| 984 | } |
---|
| 985 | |
---|
| 986 | cmt.m_action = action_remove; |
---|
| 987 | } |
---|
| 988 | else |
---|
| 989 | { |
---|
| 990 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : version missing" << endl; |
---|
| 991 | help_action = action_help; |
---|
| 992 | cmt.m_action = action_remove; |
---|
| 993 | } |
---|
| 994 | } |
---|
| 995 | } |
---|
| 996 | else |
---|
| 997 | { |
---|
| 998 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to remove" << endl; |
---|
| 999 | help_action = action_help; |
---|
| 1000 | cmt.m_action = action_remove; |
---|
| 1001 | } |
---|
| 1002 | } |
---|
| 1003 | |
---|
| 1004 | void ArgParser::do_run () |
---|
| 1005 | { |
---|
| 1006 | if (argc > 0) |
---|
| 1007 | { |
---|
| 1008 | fill_arguments (); |
---|
| 1009 | cmt.m_action = action_run; |
---|
| 1010 | } |
---|
| 1011 | else |
---|
| 1012 | { |
---|
| 1013 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : run arguments missing" << endl; |
---|
| 1014 | help_action = action_help; |
---|
| 1015 | cmt.m_action = action_run; |
---|
| 1016 | } |
---|
| 1017 | } |
---|
| 1018 | |
---|
| 1019 | void ArgParser::do_run_sequence () |
---|
| 1020 | { |
---|
| 1021 | if (argc > 0) |
---|
| 1022 | { |
---|
| 1023 | fill_one_argument (); |
---|
| 1024 | cmt.m_action = action_run_sequence; |
---|
| 1025 | } |
---|
| 1026 | else |
---|
| 1027 | { |
---|
| 1028 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : run_sequence arguments missing" << endl; |
---|
| 1029 | help_action = action_help; |
---|
| 1030 | cmt.m_action = action_run_sequence; |
---|
| 1031 | } |
---|
| 1032 | } |
---|
| 1033 | |
---|
| 1034 | void ArgParser::do_set () |
---|
| 1035 | { |
---|
| 1036 | if (argc > 0) |
---|
| 1037 | { |
---|
| 1038 | arg = argv[0]; |
---|
| 1039 | |
---|
| 1040 | shift (); |
---|
| 1041 | |
---|
| 1042 | if (arg == "version") |
---|
| 1043 | { |
---|
| 1044 | fill_arguments (); |
---|
| 1045 | cmt.m_action = action_set_version; |
---|
| 1046 | } |
---|
| 1047 | else if (arg == "versions") |
---|
| 1048 | { |
---|
| 1049 | fill_arguments (); |
---|
| 1050 | |
---|
| 1051 | cmt.m_action = action_set_versions; |
---|
| 1052 | |
---|
| 1053 | if (cmt.m_scope_filtering_mode == default_filtering_mode) |
---|
| 1054 | { |
---|
| 1055 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 1056 | } |
---|
| 1057 | } |
---|
| 1058 | else |
---|
| 1059 | { |
---|
| 1060 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad set argument" << endl; |
---|
| 1061 | help_action = action_help; |
---|
| 1062 | //cmt.m_action = action_set; |
---|
| 1063 | } |
---|
| 1064 | } |
---|
| 1065 | else |
---|
| 1066 | { |
---|
| 1067 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to set" << endl; |
---|
| 1068 | help_action = action_help; |
---|
| 1069 | //cmt.m_action = action_set; |
---|
| 1070 | } |
---|
| 1071 | } |
---|
| 1072 | |
---|
| 1073 | void ArgParser::do_setup () |
---|
| 1074 | { |
---|
| 1075 | cmt.m_action = action_setup; |
---|
| 1076 | } |
---|
| 1077 | |
---|
| 1078 | void ArgParser::do_show () |
---|
| 1079 | { |
---|
| 1080 | if (argc > 0) |
---|
| 1081 | { |
---|
| 1082 | arg = argv[0]; |
---|
| 1083 | |
---|
| 1084 | //cerr << "Running show arg=" << arg << endl; |
---|
| 1085 | |
---|
| 1086 | shift (); |
---|
| 1087 | |
---|
| 1088 | if (arg == "action") |
---|
| 1089 | { |
---|
| 1090 | if (argc > 0) |
---|
| 1091 | { |
---|
| 1092 | cmt.m_current_target = fill_one_argument (); |
---|
| 1093 | cmt.m_action = action_show_action; |
---|
| 1094 | } |
---|
| 1095 | else |
---|
| 1096 | { |
---|
| 1097 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : action name missing" << endl; |
---|
| 1098 | help_action = action_help; |
---|
| 1099 | cmt.m_action = action_show_action; |
---|
| 1100 | } |
---|
| 1101 | } |
---|
| 1102 | else if (arg == "action_names") |
---|
| 1103 | { |
---|
| 1104 | if (argc > 0) |
---|
| 1105 | { |
---|
| 1106 | fill_one_argument (); |
---|
| 1107 | } |
---|
| 1108 | |
---|
| 1109 | cmt.m_action = action_show_action_names; |
---|
| 1110 | } |
---|
| 1111 | else if (arg == "action_value") |
---|
| 1112 | { |
---|
| 1113 | cmt.m_quiet = true; |
---|
| 1114 | if (argc > 0) |
---|
| 1115 | { |
---|
| 1116 | cmt.m_current_target = fill_one_argument (); |
---|
| 1117 | cmt.m_action = action_show_action_value; |
---|
| 1118 | } |
---|
| 1119 | else |
---|
| 1120 | { |
---|
| 1121 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : action name missing" << endl; |
---|
| 1122 | help_action = action_help; |
---|
| 1123 | cmt.m_action = action_show_action_value; |
---|
| 1124 | } |
---|
| 1125 | } |
---|
| 1126 | else if (arg == "actions") |
---|
| 1127 | { |
---|
| 1128 | if (argc > 0) |
---|
| 1129 | { |
---|
| 1130 | fill_one_argument (); |
---|
| 1131 | } |
---|
| 1132 | |
---|
| 1133 | cmt.m_action = action_show_actions; |
---|
| 1134 | } |
---|
| 1135 | else if (arg == "all_tags") |
---|
| 1136 | { |
---|
| 1137 | cmt.m_action = action_show_all_tags; |
---|
| 1138 | } |
---|
| 1139 | else if (arg == "applied_patterns") |
---|
| 1140 | { |
---|
| 1141 | cmt.m_action = action_show_applied_patterns; |
---|
| 1142 | } |
---|
| 1143 | else if (arg == "author") |
---|
| 1144 | { |
---|
| 1145 | cmt.m_action = action_show_author; |
---|
| 1146 | } |
---|
| 1147 | else if (arg == "branches") |
---|
| 1148 | { |
---|
| 1149 | cmt.m_action = action_show_branches; |
---|
| 1150 | } |
---|
| 1151 | else if (arg == "clients") |
---|
| 1152 | { |
---|
| 1153 | if (argc > 0) |
---|
| 1154 | { |
---|
| 1155 | cmt.m_current_target = fill_one_argument (); |
---|
| 1156 | |
---|
| 1157 | cmt.m_action = action_show_clients; |
---|
| 1158 | |
---|
| 1159 | if (argc > 0) |
---|
| 1160 | { |
---|
| 1161 | fill_one_argument (); |
---|
| 1162 | if (argc > 0) |
---|
| 1163 | { |
---|
| 1164 | fill_one_argument (); |
---|
| 1165 | } |
---|
| 1166 | } |
---|
| 1167 | } |
---|
| 1168 | else |
---|
| 1169 | { |
---|
| 1170 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : package name missing" << endl; |
---|
| 1171 | help_action = action_help; |
---|
| 1172 | cmt.m_action = action_show_clients; |
---|
| 1173 | } |
---|
| 1174 | } |
---|
| 1175 | else if (arg == "cmtpath_patterns") |
---|
| 1176 | { |
---|
| 1177 | cmt.m_action = action_show_cmtpath_patterns; |
---|
| 1178 | } |
---|
| 1179 | else if (arg == "constituent") |
---|
| 1180 | { |
---|
| 1181 | if (argc > 0) |
---|
| 1182 | { |
---|
| 1183 | cmt.m_current_target = fill_one_argument (); |
---|
| 1184 | cmt.m_action = action_show_constituent; |
---|
| 1185 | } |
---|
| 1186 | else |
---|
| 1187 | { |
---|
| 1188 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : constituent name missing" << endl; |
---|
| 1189 | help_action = action_help; |
---|
| 1190 | cmt.m_action = action_show_constituent; |
---|
| 1191 | } |
---|
| 1192 | } |
---|
| 1193 | else if (arg == "constituent_names") |
---|
| 1194 | { |
---|
| 1195 | cmt.m_action = action_show_constituent_names; |
---|
| 1196 | } |
---|
| 1197 | else if (arg == "constituents") |
---|
| 1198 | { |
---|
| 1199 | cmt.m_action = action_show_constituents; |
---|
| 1200 | } |
---|
| 1201 | else if (arg == "cycles") |
---|
| 1202 | { |
---|
| 1203 | cmt.m_action = action_show_cycles; |
---|
| 1204 | } |
---|
| 1205 | else if (arg == "fragment") |
---|
| 1206 | { |
---|
| 1207 | if (argc > 0) |
---|
| 1208 | { |
---|
| 1209 | cmt.m_current_target = fill_one_argument (); |
---|
| 1210 | cmt.m_action = action_show_fragment; |
---|
| 1211 | } |
---|
| 1212 | else |
---|
| 1213 | { |
---|
| 1214 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : fragment name missing" << endl; |
---|
| 1215 | help_action = action_help; |
---|
| 1216 | cmt.m_action = action_show_fragment; |
---|
| 1217 | } |
---|
| 1218 | } |
---|
| 1219 | else if (arg == "fragments") |
---|
| 1220 | { |
---|
| 1221 | cmt.m_action = action_show_fragments; |
---|
| 1222 | } |
---|
| 1223 | else if (arg == "groups") |
---|
| 1224 | { |
---|
| 1225 | cmt.m_action = action_show_groups; |
---|
| 1226 | } |
---|
| 1227 | else if (arg == "include_dirs") |
---|
| 1228 | { |
---|
| 1229 | cmt.m_action = action_show_include_dirs; |
---|
| 1230 | } |
---|
| 1231 | else if (arg == "language") |
---|
| 1232 | { |
---|
| 1233 | if (argc > 0) |
---|
| 1234 | { |
---|
| 1235 | cmt.m_current_target = fill_one_argument (); |
---|
| 1236 | cmt.m_action = action_show_language; |
---|
| 1237 | } |
---|
| 1238 | else |
---|
| 1239 | { |
---|
| 1240 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : language name missing" << endl; |
---|
| 1241 | help_action = action_help; |
---|
| 1242 | cmt.m_action = action_show_language; |
---|
| 1243 | } |
---|
| 1244 | } |
---|
| 1245 | else if (arg == "languages") |
---|
| 1246 | { |
---|
| 1247 | cmt.m_action = action_show_languages; |
---|
| 1248 | } |
---|
| 1249 | else if (arg == "macro") |
---|
| 1250 | { |
---|
| 1251 | if (argc > 0) |
---|
| 1252 | { |
---|
| 1253 | cmt.m_current_target = fill_one_argument (); |
---|
| 1254 | cmt.m_action = action_show_macro; |
---|
| 1255 | } |
---|
| 1256 | else |
---|
| 1257 | { |
---|
| 1258 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : macro name missing" << endl; |
---|
| 1259 | help_action = action_help; |
---|
| 1260 | cmt.m_action = action_show_macro; |
---|
| 1261 | } |
---|
| 1262 | } |
---|
| 1263 | else if (arg == "macro_names") |
---|
| 1264 | { |
---|
| 1265 | if (argc > 0) |
---|
| 1266 | { |
---|
| 1267 | fill_one_argument (); |
---|
| 1268 | } |
---|
| 1269 | |
---|
| 1270 | cmt.m_action = action_show_macro_names; |
---|
| 1271 | } |
---|
| 1272 | else if (arg == "macro_value") |
---|
| 1273 | { |
---|
| 1274 | cmt.m_quiet = true; |
---|
| 1275 | if (argc > 0) |
---|
| 1276 | { |
---|
| 1277 | cmt.m_current_target = fill_one_argument (); |
---|
| 1278 | cmt.m_action = action_show_macro_value; |
---|
| 1279 | } |
---|
| 1280 | else |
---|
| 1281 | { |
---|
| 1282 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : macro name missing" << endl; |
---|
| 1283 | help_action = action_help; |
---|
| 1284 | cmt.m_action = action_show_macro_value; |
---|
| 1285 | } |
---|
| 1286 | } |
---|
| 1287 | else if (arg == "macros") |
---|
| 1288 | { |
---|
| 1289 | if (argc > 0) |
---|
| 1290 | { |
---|
| 1291 | fill_one_argument (); |
---|
| 1292 | } |
---|
| 1293 | |
---|
| 1294 | cmt.m_action = action_show_macros; |
---|
| 1295 | } |
---|
| 1296 | else if (arg == "manager") |
---|
| 1297 | { |
---|
| 1298 | cmt.m_action = action_show_manager; |
---|
| 1299 | } |
---|
| 1300 | else if (arg == "packages") |
---|
| 1301 | { |
---|
| 1302 | if (argc > 0) |
---|
| 1303 | { |
---|
| 1304 | cmt.m_current_target = fill_one_argument (); |
---|
| 1305 | } |
---|
| 1306 | |
---|
| 1307 | cmt.m_action = action_show_packages; |
---|
| 1308 | } |
---|
| 1309 | else if (arg == "path") |
---|
| 1310 | { |
---|
| 1311 | cmt.m_action = action_show_path; |
---|
| 1312 | } |
---|
| 1313 | else if (arg == "pattern") |
---|
| 1314 | { |
---|
| 1315 | if (argc > 0) |
---|
| 1316 | { |
---|
| 1317 | cmt.m_current_target = fill_one_argument (); |
---|
| 1318 | cmt.m_action = action_show_pattern; |
---|
| 1319 | } |
---|
| 1320 | else |
---|
| 1321 | { |
---|
| 1322 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : pattern name missing" << endl; |
---|
| 1323 | help_action = action_help; |
---|
| 1324 | cmt.m_action = action_show_pattern; |
---|
| 1325 | } |
---|
| 1326 | } |
---|
| 1327 | else if (arg == "pattern_names") |
---|
| 1328 | { |
---|
| 1329 | cmt.m_action = action_show_pattern_names; |
---|
| 1330 | } |
---|
| 1331 | else if (arg == "patterns") |
---|
| 1332 | { |
---|
| 1333 | cmt.m_action = action_show_patterns; |
---|
| 1334 | } |
---|
| 1335 | else if (arg == "projects") |
---|
| 1336 | { |
---|
| 1337 | cmt.m_action = action_show_projects; |
---|
| 1338 | } |
---|
| 1339 | else if (arg == "pwd") |
---|
| 1340 | { |
---|
| 1341 | cmt.m_action = action_show_pwd; |
---|
| 1342 | } |
---|
| 1343 | else if (arg == "setup") |
---|
| 1344 | { |
---|
| 1345 | cmt.m_action = action_show_setup; |
---|
| 1346 | |
---|
| 1347 | if (cmt.m_scope_filtering_mode == default_filtering_mode) |
---|
| 1348 | { |
---|
| 1349 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 1350 | } |
---|
| 1351 | } |
---|
| 1352 | else if (arg == "set_names") |
---|
| 1353 | { |
---|
| 1354 | if (argc > 0) |
---|
| 1355 | { |
---|
| 1356 | fill_one_argument (); |
---|
| 1357 | } |
---|
| 1358 | |
---|
| 1359 | cmt.m_action = action_show_set_names; |
---|
| 1360 | } |
---|
| 1361 | else if (arg == "set_value") |
---|
| 1362 | { |
---|
| 1363 | cmt.m_quiet = true; |
---|
| 1364 | if (argc > 0) |
---|
| 1365 | { |
---|
| 1366 | cmt.m_current_target = fill_one_argument (); |
---|
| 1367 | cmt.m_action = action_show_set_value; |
---|
| 1368 | } |
---|
| 1369 | else |
---|
| 1370 | { |
---|
| 1371 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : set name missing" << endl; |
---|
| 1372 | help_action = action_help; |
---|
| 1373 | cmt.m_action = action_show_set_value; |
---|
| 1374 | } |
---|
| 1375 | } |
---|
| 1376 | else if (arg == "set") |
---|
| 1377 | { |
---|
| 1378 | if (argc > 0) |
---|
| 1379 | { |
---|
| 1380 | cmt.m_current_target = fill_one_argument (); |
---|
| 1381 | cmt.m_action = action_show_set; |
---|
| 1382 | } |
---|
| 1383 | else |
---|
| 1384 | { |
---|
| 1385 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : set name missing" << endl; |
---|
| 1386 | help_action = action_help; |
---|
| 1387 | cmt.m_action = action_show_set; |
---|
| 1388 | } |
---|
| 1389 | } |
---|
| 1390 | else if (arg == "sets") |
---|
| 1391 | { |
---|
| 1392 | if (argc > 0) |
---|
| 1393 | { |
---|
| 1394 | fill_one_argument (); |
---|
| 1395 | } |
---|
| 1396 | |
---|
| 1397 | cmt.m_action = action_show_sets; |
---|
| 1398 | } |
---|
| 1399 | else if (arg == "strategies") |
---|
| 1400 | { |
---|
| 1401 | cmt.m_action = action_show_strategies; |
---|
| 1402 | } |
---|
| 1403 | else if (arg == "tags") |
---|
| 1404 | { |
---|
| 1405 | cmt.m_action = action_show_tags; |
---|
| 1406 | } |
---|
| 1407 | else if (arg == "use_paths") |
---|
| 1408 | { |
---|
| 1409 | if (argc > 0) |
---|
| 1410 | { |
---|
| 1411 | while (argc > 0) |
---|
| 1412 | { |
---|
| 1413 | if (strcmp (argv[0], "-private") == 0) |
---|
| 1414 | { |
---|
| 1415 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 1416 | } |
---|
| 1417 | else if (strcmp (argv[0], "--private") == 0) |
---|
| 1418 | { |
---|
| 1419 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 1420 | } |
---|
| 1421 | else |
---|
| 1422 | { |
---|
| 1423 | cmt_string& s = arguments.add (); |
---|
| 1424 | s = argv[0]; |
---|
| 1425 | } |
---|
| 1426 | |
---|
| 1427 | shift (); |
---|
| 1428 | } |
---|
| 1429 | |
---|
| 1430 | cmt.m_action = action_show_use_paths; |
---|
| 1431 | } |
---|
| 1432 | else |
---|
| 1433 | { |
---|
| 1434 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : package name missing" << endl; |
---|
| 1435 | help_action = action_help; |
---|
| 1436 | cmt.m_action = action_show_use_paths; |
---|
| 1437 | } |
---|
| 1438 | } |
---|
| 1439 | else if ((arg == "u") || |
---|
| 1440 | (arg == "us") || |
---|
| 1441 | (arg == "use") || |
---|
| 1442 | (arg == "uses")) |
---|
| 1443 | { |
---|
| 1444 | cmt.m_action = action_show_uses; |
---|
| 1445 | |
---|
| 1446 | if (cmt.m_scope_filtering_mode == default_filtering_mode) |
---|
| 1447 | { |
---|
| 1448 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 1449 | } |
---|
| 1450 | } |
---|
| 1451 | else if (arg == "version") |
---|
| 1452 | { |
---|
| 1453 | cmt.m_action = action_show_version; |
---|
| 1454 | } |
---|
| 1455 | else if (arg == "versions") |
---|
| 1456 | { |
---|
| 1457 | if (argc > 0) |
---|
| 1458 | { |
---|
| 1459 | cmt.m_current_target = fill_one_argument (); |
---|
| 1460 | cmt.m_action = action_show_versions; |
---|
| 1461 | } |
---|
| 1462 | else |
---|
| 1463 | { |
---|
| 1464 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : package name missing" << endl; |
---|
| 1465 | help_action = action_help; |
---|
| 1466 | cmt.m_action = action_show_versions; |
---|
| 1467 | } |
---|
| 1468 | } |
---|
| 1469 | else |
---|
| 1470 | { |
---|
| 1471 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad show argument" << endl; |
---|
| 1472 | help_action = action_help; |
---|
| 1473 | cmt.m_action = action_show; |
---|
| 1474 | } |
---|
| 1475 | } |
---|
| 1476 | else |
---|
| 1477 | { |
---|
| 1478 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to show" << endl; |
---|
| 1479 | help_action = action_help; |
---|
| 1480 | cmt.m_action = action_show; |
---|
| 1481 | } |
---|
| 1482 | } |
---|
| 1483 | |
---|
| 1484 | void ArgParser::do_system () |
---|
| 1485 | { |
---|
| 1486 | cmt.m_action = action_system; |
---|
| 1487 | } |
---|
| 1488 | |
---|
| 1489 | void ArgParser::do_unlock () |
---|
| 1490 | { |
---|
| 1491 | if (argc > 0) |
---|
| 1492 | { |
---|
| 1493 | cmt.m_current_package = fill_one_argument (); |
---|
| 1494 | cmt.m_current_version.erase (0); |
---|
| 1495 | cmt.m_current_path.erase (0); |
---|
| 1496 | |
---|
| 1497 | if (argc > 0) |
---|
| 1498 | { |
---|
| 1499 | cmt.m_current_version = fill_one_argument (); |
---|
| 1500 | cmt.m_action = action_unlock; |
---|
| 1501 | |
---|
| 1502 | if (argc > 0) |
---|
| 1503 | { |
---|
| 1504 | cmt.m_current_path = fill_one_argument_filtered (); |
---|
| 1505 | } |
---|
| 1506 | |
---|
| 1507 | cmt.m_current_access = UserMode; |
---|
| 1508 | (Use::current()).set (cmt.m_current_package, |
---|
| 1509 | cmt.m_current_version, |
---|
| 1510 | cmt.m_current_path); |
---|
| 1511 | |
---|
| 1512 | } |
---|
| 1513 | else |
---|
| 1514 | { |
---|
| 1515 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : version missing" << endl; |
---|
| 1516 | help_action = action_help; |
---|
| 1517 | cmt.m_action = action_unlock; |
---|
| 1518 | } |
---|
| 1519 | } |
---|
| 1520 | else |
---|
| 1521 | { |
---|
| 1522 | cmt.m_action = action_unlock; |
---|
| 1523 | } |
---|
| 1524 | } |
---|
| 1525 | |
---|
| 1526 | void ArgParser::do_version () |
---|
| 1527 | { |
---|
| 1528 | cmt.m_action = action_version; |
---|
| 1529 | } |
---|
| 1530 | |
---|
| 1531 | void ArgParser::do_add_path () |
---|
| 1532 | { |
---|
| 1533 | cmt_string here = CmtSystem::pwd (); |
---|
| 1534 | |
---|
| 1535 | if (CmtSystem::cd (arg)) |
---|
| 1536 | { |
---|
| 1537 | arg = CmtSystem::pwd (); |
---|
| 1538 | |
---|
| 1539 | //cerr << "Adding path " << arg << endl; |
---|
| 1540 | |
---|
| 1541 | IProjectFactory& factory = ProjectFactory::instance (); |
---|
| 1542 | CmtSystem::add_cmt_path (arg, "argument", factory); |
---|
| 1543 | CmtSystem::cd (here); |
---|
| 1544 | } |
---|
| 1545 | } |
---|
| 1546 | |
---|
| 1547 | void ArgParser::option_help () |
---|
| 1548 | { |
---|
| 1549 | help_action = action_help; |
---|
| 1550 | } |
---|
| 1551 | |
---|
| 1552 | void ArgParser::option_n () |
---|
| 1553 | { |
---|
| 1554 | cmt.m_simulation = true; |
---|
| 1555 | } |
---|
| 1556 | |
---|
| 1557 | void ArgParser::option_quiet () |
---|
| 1558 | { |
---|
| 1559 | cmt.m_quiet = true; |
---|
| 1560 | } |
---|
| 1561 | |
---|
| 1562 | void ArgParser::option_csh () |
---|
| 1563 | { |
---|
| 1564 | mode = Csh; |
---|
| 1565 | } |
---|
| 1566 | |
---|
| 1567 | void ArgParser::option_sh () |
---|
| 1568 | { |
---|
| 1569 | mode = Sh; |
---|
| 1570 | } |
---|
| 1571 | |
---|
| 1572 | void ArgParser::option_bat () |
---|
| 1573 | { |
---|
| 1574 | mode = Bat; |
---|
| 1575 | } |
---|
| 1576 | |
---|
| 1577 | void ArgParser::option_use () |
---|
| 1578 | { |
---|
| 1579 | if (cmt.m_action != action_create) |
---|
| 1580 | { |
---|
| 1581 | CmtSystem::cmt_string_vector words; |
---|
| 1582 | |
---|
| 1583 | CmtSystem::split (arg, ":", words); |
---|
| 1584 | |
---|
| 1585 | cmt.m_current_access = UserMode; |
---|
| 1586 | |
---|
| 1587 | if (words.size () > 0) cmt.m_current_package = words[0]; |
---|
| 1588 | if (words.size () > 1) cmt.m_current_version = words[1]; |
---|
| 1589 | if (words.size () > 2) cmt.m_current_path = words[2]; |
---|
| 1590 | (Use::current()).set (cmt.m_current_package, |
---|
| 1591 | cmt.m_current_version, |
---|
| 1592 | cmt.m_current_path); |
---|
| 1593 | } |
---|
| 1594 | } |
---|
| 1595 | |
---|
| 1596 | void ArgParser::option_pack () |
---|
| 1597 | { |
---|
| 1598 | if ((cmt.m_action != action_create) && (cmt.m_current_package != arg)) |
---|
| 1599 | { |
---|
| 1600 | //CmtSystem::cd (cmt.m_default_path); |
---|
| 1601 | |
---|
| 1602 | cmt.m_current_access = UserMode; |
---|
| 1603 | |
---|
| 1604 | cmt.m_current_package = arg; |
---|
| 1605 | cmt.m_current_version = ""; |
---|
| 1606 | |
---|
| 1607 | /* |
---|
| 1608 | cerr << "ArgParser::option_pack> " |
---|
| 1609 | << " cp=" << cmt.m_current_package |
---|
| 1610 | << " cv=" << cmt.m_current_version |
---|
| 1611 | << " cp=" << cmt.m_current_path << endl; |
---|
| 1612 | */ |
---|
| 1613 | |
---|
| 1614 | (Use::current()).set (cmt.m_current_package, |
---|
| 1615 | cmt.m_current_version, |
---|
| 1616 | cmt.m_current_path); |
---|
| 1617 | } |
---|
| 1618 | } |
---|
| 1619 | |
---|
| 1620 | void ArgParser::option_version () |
---|
| 1621 | { |
---|
| 1622 | if ((cmt.m_action != action_create) && (cmt.m_current_version != arg)) |
---|
| 1623 | { |
---|
| 1624 | cmt.m_current_access = UserMode; |
---|
| 1625 | cmt.m_current_version = arg; |
---|
| 1626 | |
---|
| 1627 | /* |
---|
| 1628 | cerr << "ArgParser::option_version> " |
---|
| 1629 | << " cp=" << cmt.m_current_package |
---|
| 1630 | << " cv=" << cmt.m_current_version |
---|
| 1631 | << " cp=" << cmt.m_current_path << endl; |
---|
| 1632 | */ |
---|
| 1633 | |
---|
| 1634 | (Use::current()).set (cmt.m_current_package, |
---|
| 1635 | cmt.m_current_version, |
---|
| 1636 | cmt.m_current_path); |
---|
| 1637 | } |
---|
| 1638 | } |
---|
| 1639 | |
---|
| 1640 | void ArgParser::option_path () |
---|
| 1641 | { |
---|
| 1642 | if ((cmt.m_action != action_create) && (cmt.m_current_path != arg)) |
---|
| 1643 | { |
---|
| 1644 | cmt.m_current_access = UserMode; |
---|
| 1645 | cmt.m_current_path = arg; |
---|
| 1646 | |
---|
| 1647 | /* |
---|
| 1648 | cerr << "ArgParser::option_path> " |
---|
| 1649 | << " cp=" << cmt.m_current_package |
---|
| 1650 | << " cv=" << cmt.m_current_version |
---|
| 1651 | << " cp=" << cmt.m_current_path << endl; |
---|
| 1652 | */ |
---|
| 1653 | |
---|
| 1654 | (Use::current()).set (cmt.m_current_package, |
---|
| 1655 | cmt.m_current_version, |
---|
| 1656 | cmt.m_current_path); |
---|
| 1657 | |
---|
| 1658 | //IProjectFactory& factory = ProjectFactory::instance (); |
---|
| 1659 | //CmtSystem::add_cmt_path (cmt.m_current_path, "argument", factory); |
---|
| 1660 | } |
---|
| 1661 | } |
---|
| 1662 | |
---|
| 1663 | void ArgParser::option_f () |
---|
| 1664 | { |
---|
| 1665 | extra_file = arg; |
---|
| 1666 | } |
---|
| 1667 | |
---|
| 1668 | void ArgParser::option_e () |
---|
| 1669 | { |
---|
| 1670 | cerr << "#CMT> Warning: extra statement = " << arg << endl; |
---|
| 1671 | extra_line = arg; |
---|
| 1672 | } |
---|
| 1673 | |
---|
| 1674 | void ArgParser::option_home () |
---|
| 1675 | { |
---|
| 1676 | if (CmtSystem::test_directory (arg)) |
---|
| 1677 | { |
---|
| 1678 | cmt.m_cmt_home = arg; |
---|
| 1679 | } |
---|
| 1680 | } |
---|
| 1681 | |
---|
| 1682 | void ArgParser::option_tag () |
---|
| 1683 | { |
---|
| 1684 | /* |
---|
| 1685 | Here we are going to change the complete tag set |
---|
| 1686 | */ |
---|
| 1687 | |
---|
| 1688 | if (arg != "") |
---|
| 1689 | { |
---|
| 1690 | Tag* tag; |
---|
| 1691 | CmtSystem::cmt_string_vector words; |
---|
| 1692 | |
---|
| 1693 | // First reset selection of all existing tags |
---|
| 1694 | //Tag::clear_all (); |
---|
| 1695 | Tag::unmark_all (); |
---|
| 1696 | cmt.m_extra_tags = ","; |
---|
| 1697 | |
---|
| 1698 | // Then restore CMTSITE |
---|
| 1699 | Cmt::configure_version_tag (); |
---|
| 1700 | Cmt::configure_site_tag (0); |
---|
| 1701 | Cmt::configure_uname_tag (); |
---|
| 1702 | Cmt::configure_hosttype_tag (); |
---|
| 1703 | Cmt::configure_config_tag (); |
---|
| 1704 | Cmt::configure_home (0); |
---|
| 1705 | Cmt::guess_current_project (); |
---|
| 1706 | |
---|
| 1707 | CmtSystem::split (arg, " \t,", words); |
---|
| 1708 | |
---|
| 1709 | for (int i = 0; i < words.size (); i++) |
---|
| 1710 | { |
---|
| 1711 | const cmt_string& a = words[i]; |
---|
| 1712 | |
---|
| 1713 | cmt_string s = ","; |
---|
| 1714 | s += a; |
---|
| 1715 | s += ","; |
---|
| 1716 | |
---|
| 1717 | if (i == 0) |
---|
| 1718 | { |
---|
| 1719 | cmt.m_current_tag = a; |
---|
| 1720 | |
---|
| 1721 | if (CmtSystem::testenv ("TAGDEBUG")) cerr |
---|
| 1722 | << "parse_argument(tag_add)> current_tag=" << cmt.m_current_tag << endl; |
---|
| 1723 | } |
---|
| 1724 | |
---|
| 1725 | if (cmt.m_extra_tags.find (s) == cmt_string::npos) |
---|
| 1726 | { |
---|
| 1727 | //if (!cmt.m_quiet) cerr << " a=[" << a << "]" << endl; |
---|
| 1728 | |
---|
| 1729 | // Then restore uname if the specified tag is CMTCONFIG |
---|
| 1730 | if (a == CmtSystem::get_cmt_config ()) |
---|
| 1731 | { |
---|
| 1732 | Cmt::configure_uname_tag (); |
---|
| 1733 | } |
---|
| 1734 | |
---|
| 1735 | tag = Tag::add (a, PriorityArgument, "arguments", 0); |
---|
| 1736 | |
---|
| 1737 | tag->mark (); |
---|
| 1738 | |
---|
| 1739 | cmt.m_extra_tags += a; |
---|
| 1740 | cmt.m_extra_tags += ","; |
---|
| 1741 | } |
---|
| 1742 | } |
---|
| 1743 | } |
---|
| 1744 | } |
---|
| 1745 | |
---|
| 1746 | void ArgParser::option_tag_add () |
---|
| 1747 | { |
---|
| 1748 | Tag* tag; |
---|
| 1749 | CmtSystem::cmt_string_vector words; |
---|
| 1750 | |
---|
| 1751 | //if (!cmt.m_quiet) cerr << "-tag_add=" << arg << endl; |
---|
| 1752 | |
---|
| 1753 | CmtSystem::split (arg, " \t,", words); |
---|
| 1754 | |
---|
| 1755 | for (int i = 0; i < words.size (); i++) |
---|
| 1756 | { |
---|
| 1757 | const cmt_string& a = words[i]; |
---|
| 1758 | |
---|
| 1759 | cmt_string s = ","; |
---|
| 1760 | s += a; |
---|
| 1761 | s += ","; |
---|
| 1762 | |
---|
| 1763 | if (cmt.m_extra_tags.find (s) == cmt_string::npos) |
---|
| 1764 | { |
---|
| 1765 | //if (!cmt.m_quiet) cerr << " a=[" << a << "]" << endl; |
---|
| 1766 | |
---|
| 1767 | /// Then restore uname if the specified tag is CMTCONFIG |
---|
| 1768 | if (a == CmtSystem::get_cmt_config ()) |
---|
| 1769 | { |
---|
| 1770 | Cmt::configure_uname_tag (); |
---|
| 1771 | } |
---|
| 1772 | |
---|
| 1773 | tag = Tag::add (a, PriorityUserTag, "arguments", 0); |
---|
| 1774 | |
---|
| 1775 | tag->mark (); |
---|
| 1776 | |
---|
| 1777 | cmt.m_extra_tags += a; |
---|
| 1778 | cmt.m_extra_tags += ","; |
---|
| 1779 | } |
---|
| 1780 | } |
---|
| 1781 | } |
---|
| 1782 | |
---|
| 1783 | void ArgParser::option_tag_remove () |
---|
| 1784 | { |
---|
| 1785 | Tag::TagPtrVector tags = Tag::tags (); |
---|
| 1786 | int i; |
---|
| 1787 | Tag* tag; |
---|
| 1788 | |
---|
| 1789 | /* |
---|
| 1790 | for (i = 0; i < tags.size (); i++) |
---|
| 1791 | { |
---|
| 1792 | tag = tags[i]; |
---|
| 1793 | if ((tag != 0) && |
---|
| 1794 | (tag->selected)) |
---|
| 1795 | { |
---|
| 1796 | if (!cmt.m_quiet) cerr << " original tag_list=" << tag->name << tag->priority << endl; |
---|
| 1797 | } |
---|
| 1798 | } |
---|
| 1799 | */ |
---|
| 1800 | |
---|
| 1801 | CmtSystem::cmt_string_vector words; |
---|
| 1802 | |
---|
| 1803 | //if (!cmt.m_quiet) cerr << "-arg_remove=" << arg << endl; |
---|
| 1804 | |
---|
| 1805 | CmtSystem::split (arg, " \t,", words); |
---|
| 1806 | |
---|
| 1807 | // |
---|
| 1808 | // Now erase all entries in the old list that match |
---|
| 1809 | // the specified tags |
---|
| 1810 | // |
---|
| 1811 | |
---|
| 1812 | for (i = 0; i < words.size (); i++) |
---|
| 1813 | { |
---|
| 1814 | const cmt_string& a = words[i]; |
---|
| 1815 | |
---|
| 1816 | cmt_string s = ","; |
---|
| 1817 | s += a; |
---|
| 1818 | s += ","; |
---|
| 1819 | |
---|
| 1820 | int pos; |
---|
| 1821 | |
---|
| 1822 | pos = cmt.m_extra_tags.find (s); |
---|
| 1823 | |
---|
| 1824 | if (pos != cmt_string::npos) |
---|
| 1825 | { |
---|
| 1826 | cmt.m_extra_tags.erase (pos, s.size () - 1); |
---|
| 1827 | } |
---|
| 1828 | |
---|
| 1829 | //if (!cmt.m_quiet) cerr << " tag_list=[" << tag_list << "]" << endl; |
---|
| 1830 | } |
---|
| 1831 | |
---|
| 1832 | // |
---|
| 1833 | // Now reinject the purged list of tags into the database |
---|
| 1834 | // exactly as when using -tag=<tag-list> |
---|
| 1835 | // |
---|
| 1836 | |
---|
| 1837 | /// First forget about all existing tags |
---|
| 1838 | Tag::unmark_all (); |
---|
| 1839 | |
---|
| 1840 | /// Then restore CMTSITE |
---|
| 1841 | Cmt::configure_version_tag (); |
---|
| 1842 | Cmt::configure_site_tag (0); |
---|
| 1843 | Cmt::configure_uname_tag (); |
---|
| 1844 | Cmt::configure_hosttype_tag (); |
---|
| 1845 | |
---|
| 1846 | CmtSystem::split (cmt.m_extra_tags, " \t,", words); |
---|
| 1847 | |
---|
| 1848 | for (i = 0; i < words.size (); i++) |
---|
| 1849 | { |
---|
| 1850 | const cmt_string& a = words[i]; |
---|
| 1851 | |
---|
| 1852 | //fprintf (stderr, " a=[%s]\n", a.c_str ()); |
---|
| 1853 | |
---|
| 1854 | /// Then restore uname if the specified tag is CMTCONFIG |
---|
| 1855 | if (a == CmtSystem::get_cmt_config ()) |
---|
| 1856 | { |
---|
| 1857 | Cmt::configure_uname_tag (); |
---|
| 1858 | } |
---|
| 1859 | |
---|
| 1860 | if (i == 0) |
---|
| 1861 | { |
---|
| 1862 | cmt.m_current_tag = a; |
---|
| 1863 | |
---|
| 1864 | //if (!cmt.m_quiet) cerr << "parse_argument(tag_remove)> current_tag=" |
---|
| 1865 | //<< cmt.m_current_tag << endl; |
---|
| 1866 | |
---|
| 1867 | tag = Tag::add (a, PriorityTag, "restore configuration", 0); |
---|
| 1868 | } |
---|
| 1869 | else |
---|
| 1870 | { |
---|
| 1871 | tag = Tag::add (a, PriorityUserTag, "restore configuration", 0); |
---|
| 1872 | } |
---|
| 1873 | |
---|
| 1874 | tag->mark (); |
---|
| 1875 | } |
---|
| 1876 | } |
---|
| 1877 | |
---|
| 1878 | void ArgParser::option_user_context () |
---|
| 1879 | { |
---|
| 1880 | if (CmtSystem::test_directory (arg)) |
---|
| 1881 | { |
---|
| 1882 | cmt.m_cmt_user_context = arg; |
---|
| 1883 | } |
---|
| 1884 | } |
---|
| 1885 | |
---|
| 1886 | void ArgParser::option_with_version_directory () |
---|
| 1887 | { |
---|
| 1888 | cmt.m_current_structuring_style = with_version_directory; |
---|
| 1889 | } |
---|
| 1890 | |
---|
| 1891 | void ArgParser::option_without_version_directory () |
---|
| 1892 | { |
---|
| 1893 | cmt.m_current_structuring_style = without_version_directory; |
---|
| 1894 | } |
---|
| 1895 | |
---|
| 1896 | void ArgParser::option_no_cleanup () |
---|
| 1897 | { |
---|
| 1898 | cmt.m_current_setup_strategy |= SetupNoCleanup; |
---|
| 1899 | } |
---|
| 1900 | |
---|
| 1901 | void ArgParser::option_private () |
---|
| 1902 | { |
---|
| 1903 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 1904 | } |
---|
| 1905 | |
---|
| 1906 | void ArgParser::option_public () |
---|
| 1907 | { |
---|
| 1908 | cmt.m_scope_filtering_mode = block_private_uses; |
---|
| 1909 | } |
---|
| 1910 | |
---|
| 1911 | |
---|
| 1912 | |
---|
| 1913 | |
---|
| 1914 | |
---|
| 1915 | |
---|
| 1916 | CommandHelp::HelpMap& CommandHelp::get_help () |
---|
| 1917 | { |
---|
| 1918 | static CommandHelp& me = instance (); |
---|
| 1919 | |
---|
| 1920 | return (me.m_help); |
---|
| 1921 | } |
---|
| 1922 | |
---|
| 1923 | CommandHelp::HelpTexts& CommandHelp::get_help_texts () |
---|
| 1924 | { |
---|
| 1925 | static CommandHelp& me = instance (); |
---|
| 1926 | |
---|
| 1927 | return (me.m_help_texts); |
---|
| 1928 | } |
---|
| 1929 | |
---|
| 1930 | const cmt_string& CommandHelp::get_help_text (ActionType key) |
---|
| 1931 | { |
---|
| 1932 | static const HelpTexts& help = get_help_texts (); |
---|
| 1933 | |
---|
| 1934 | const cmt_string& h = help[key]; |
---|
| 1935 | return (h); |
---|
| 1936 | } |
---|
| 1937 | |
---|
| 1938 | void CommandHelp::show_all () |
---|
| 1939 | { |
---|
| 1940 | static HelpTexts& help_texts = get_help_texts (); |
---|
| 1941 | |
---|
| 1942 | cerr << "#> cmt command [option...]" << endl; |
---|
| 1943 | cerr << "# command :" << endl; |
---|
| 1944 | |
---|
| 1945 | int i; |
---|
| 1946 | |
---|
| 1947 | for (i = 0; ; i++) |
---|
| 1948 | { |
---|
| 1949 | const cmt_string& s = help_texts[i]; |
---|
| 1950 | if (s == "") break; |
---|
| 1951 | cerr << "# " << s << endl; |
---|
| 1952 | } |
---|
| 1953 | |
---|
| 1954 | cerr << "# global options :" << endl; |
---|
| 1955 | |
---|
| 1956 | cerr << "# -quiet : don't print errors" << endl; |
---|
| 1957 | cerr << "# -use=<p>:<v>:<path> : set package version path" << endl; |
---|
| 1958 | cerr << "# -pack=<package> : set package" << endl; |
---|
| 1959 | cerr << "# -version=<version> : set version" << endl; |
---|
| 1960 | cerr << "# -path=<path> : set root path" << endl; |
---|
| 1961 | cerr << "# -f=<requirement-file> : set input file" << endl; |
---|
| 1962 | cerr << "# -e=<statement> : add a one line statement" << endl; |
---|
| 1963 | cerr << "# -tag=<tag-list> : select a new tag-set" << endl; |
---|
| 1964 | cerr << "# -tag_add=<tag-list> : add specific comma-separated tag(s)" << endl; |
---|
| 1965 | cerr << "# -tag_remove=<tag-list> : remove specific comma-separated tag(s)" << endl; |
---|
| 1966 | cerr << "# -with_version_directory : reset to default structuring style" << endl; |
---|
| 1967 | cerr << "# -without_version_directory : switch structuring style" << endl; |
---|
| 1968 | cerr << "# -cleanup : activate install area cleanup" << endl; |
---|
| 1969 | cerr << "# -no_cleanup : inhibit install area cleanup" << endl; |
---|
| 1970 | } |
---|
| 1971 | |
---|
| 1972 | void CommandHelp::show (ActionType action) |
---|
| 1973 | { |
---|
| 1974 | cerr << "CommandHelp::show> action = " << action << endl; |
---|
| 1975 | |
---|
| 1976 | static HelpTexts& help_texts = get_help_texts (); |
---|
| 1977 | |
---|
| 1978 | if (action == action_build) |
---|
| 1979 | { |
---|
| 1980 | int i; |
---|
| 1981 | |
---|
| 1982 | for (i = action_build_constituent_makefile; i <= action_build_windefs; i++) |
---|
| 1983 | { |
---|
| 1984 | const cmt_string& s = help_texts[i]; |
---|
| 1985 | cerr << "# " << s << endl; |
---|
| 1986 | } |
---|
| 1987 | } |
---|
| 1988 | if (action == action_check) |
---|
| 1989 | { |
---|
| 1990 | int i; |
---|
| 1991 | |
---|
| 1992 | for (i = action_check_configuration; i <= action_check_version; i++) |
---|
| 1993 | { |
---|
| 1994 | const cmt_string& s = help_texts[i]; |
---|
| 1995 | cerr << "# " << s << endl; |
---|
| 1996 | } |
---|
| 1997 | } |
---|
| 1998 | else if (action == action_show) |
---|
| 1999 | { |
---|
| 2000 | int i; |
---|
| 2001 | |
---|
| 2002 | for (i = (action_show + 1); i <= action_show_versions; i++) |
---|
| 2003 | { |
---|
| 2004 | const cmt_string& s = help_texts[i]; |
---|
| 2005 | cerr << "# " << s << endl; |
---|
| 2006 | } |
---|
| 2007 | } |
---|
| 2008 | else |
---|
| 2009 | { |
---|
| 2010 | const cmt_string& s = get_help_text (action); |
---|
| 2011 | cerr << "#" << s << endl; |
---|
| 2012 | } |
---|
| 2013 | } |
---|
| 2014 | |
---|
| 2015 | CommandHelp& CommandHelp::instance () |
---|
| 2016 | { |
---|
| 2017 | static CommandHelp me; |
---|
| 2018 | return (me); |
---|
| 2019 | } |
---|
| 2020 | |
---|
| 2021 | CommandHelp::CommandHelp () |
---|
| 2022 | { |
---|
| 2023 | static HelpMap& help = m_help; |
---|
| 2024 | |
---|
| 2025 | static HelpTexts& help_texts = m_help_texts; |
---|
| 2026 | |
---|
| 2027 | help_texts.clear (); |
---|
| 2028 | |
---|
| 2029 | help_texts.add () = "none"; |
---|
| 2030 | help_texts.add () = "awk"; |
---|
| 2031 | help_texts.add () = "broadcast [-select=list] [-exclude=list] [-local] [-global] [-begin=pattern] [-depth=n] <command> : apply a command to [some of] the used packages"; |
---|
| 2032 | help_texts.add () = "build <option> : build actions. (Try cmt help build)"; |
---|
| 2033 | help_texts.add () = "build constituent_makefile <constituent> : generate constituent Makefile fragment"; |
---|
| 2034 | help_texts.add () = "build constituents_makefile : generate constituents.make"; |
---|
| 2035 | help_texts.add () = "build dependencies : generate dependencies"; |
---|
| 2036 | help_texts.add () = "build library_links : build symbolic links towards all imported libraries"; |
---|
| 2037 | help_texts.add () = "build make_setup : build a compiled version of setup scripts"; |
---|
| 2038 | help_texts.add () = "build msdev : generate MSDEV files"; |
---|
| 2039 | help_texts.add () = "build CMT_pacman : generate PACMAN manifest file for CMT"; |
---|
| 2040 | help_texts.add () = "build vsnet : generate VS.NET files"; |
---|
| 2041 | help_texts.add () = "build os9_makefile : generate Makefile for OS9"; |
---|
| 2042 | help_texts.add () = "build prototype : generate prototype file"; |
---|
| 2043 | help_texts.add () = "build readme : generate README.html"; |
---|
| 2044 | help_texts.add () = "build tag_makefile : generate tag specific Makefile"; |
---|
| 2045 | help_texts.add () = "build temporary_name : generate a name for a temprary file"; |
---|
| 2046 | help_texts.add () = "build triggers <constituent> : generate library trigger file"; |
---|
| 2047 | help_texts.add () = "build windefs <library_name> : generate def file for Windows shared libraries"; |
---|
| 2048 | help_texts.add () = "check <option> : check actions. (Try cmt help check)"; |
---|
| 2049 | help_texts.add () = "check configuration : check configuration"; |
---|
| 2050 | help_texts.add () = "check files <old> <new> : compare two files and overrides <old> by <new> if different"; |
---|
| 2051 | help_texts.add () = "check version <name> : check if a name follows a version tag syntax "; |
---|
| 2052 | help_texts.add () = "co | checkout : perform a cvs checkout over a CMT package"; |
---|
| 2053 | help_texts.add () = "cleanup [-csh|-sh|-bat] : generate a cleanup script"; |
---|
| 2054 | help_texts.add () = "config : generate setup and cleanup scripts"; |
---|
| 2055 | help_texts.add () = "create <package> <version> [<path>] : create and configure a new package"; |
---|
| 2056 | help_texts.add () = "create_project <project> : create and configure a new project"; |
---|
| 2057 | help_texts.add () = "cvsbranches <module> : display the subdirectories for a module"; |
---|
| 2058 | help_texts.add () = "cvssubpackagess <module> : display the subpackages for a module"; |
---|
| 2059 | help_texts.add () = "cvstags <module> : display the CVS tags for a module"; |
---|
| 2060 | help_texts.add () = "do <action> [<param>=<value>] ... : Execute an action"; |
---|
| 2061 | help_texts.add () = "expand model <model> : "; |
---|
| 2062 | help_texts.add () = "filter <in> <out> : filter a file against CMT macros and env. variables"; |
---|
| 2063 | help_texts.add () = "help | -help | --help : display this help"; |
---|
| 2064 | help_texts.add () = "load"; |
---|
| 2065 | help_texts.add () = "lock [<p> <v> [<path>]] : lock a package"; |
---|
| 2066 | help_texts.add () = "remove <package> <version> [<path>] : remove a package version"; |
---|
| 2067 | help_texts.add () = "remove library_links : remove symbolic links towards all imported libraries"; |
---|
| 2068 | help_texts.add () = "run '<command>' : apply a command"; |
---|
| 2069 | help_texts.add () = "run_sequence <sequence file> : execute a cmt equence file"; |
---|
| 2070 | help_texts.add () = "set version <version> : generate a version file in the current package"; |
---|
| 2071 | help_texts.add () = "set versions : generate version files into packages"; |
---|
| 2072 | help_texts.add () = "setup [-csh|-sh|-bat] : generate a setup script"; |
---|
| 2073 | help_texts.add () = "show <option> : query actions. (Try cmt help show)"; |
---|
| 2074 | help_texts.add () = "show action <name> : a formatted action definition"; |
---|
| 2075 | help_texts.add () = "show action_value <name> : a raw action definition"; |
---|
| 2076 | help_texts.add () = "show action_names : all action names"; |
---|
| 2077 | help_texts.add () = "show actions : all action definitions"; |
---|
| 2078 | help_texts.add () = "show all_tags : all defined tags"; |
---|
| 2079 | help_texts.add () = "show applied_patterns : all patterns actually applied"; |
---|
| 2080 | help_texts.add () = "show author : package author"; |
---|
| 2081 | help_texts.add () = "show branches : added branches"; |
---|
| 2082 | help_texts.add () = "show clients : package clients"; |
---|
| 2083 | help_texts.add () = "show cmtpath_patterns : cmtpath_patterns"; |
---|
| 2084 | help_texts.add () = "show constituent <name>: constituent definition"; |
---|
| 2085 | help_texts.add () = "show constituent_names : constituent names"; |
---|
| 2086 | help_texts.add () = "show constituents : constituent definitions"; |
---|
| 2087 | help_texts.add () = "show cycles : cycles in the use graph"; |
---|
| 2088 | help_texts.add () = "show fragment <name> : one fragment definition"; |
---|
| 2089 | help_texts.add () = "show fragments : fragment definitions"; |
---|
| 2090 | help_texts.add () = "show groups : group definitions"; |
---|
| 2091 | help_texts.add () = "show include_dirs : "; |
---|
| 2092 | help_texts.add () = "show language <name> : language definition"; |
---|
| 2093 | help_texts.add () = "show languages : language definitions"; |
---|
| 2094 | help_texts.add () = "show macro <name> : a formatted macro definition"; |
---|
| 2095 | help_texts.add () = "show macro_value <name> : a raw macro definition"; |
---|
| 2096 | help_texts.add () = "show macro_names : all macro names"; |
---|
| 2097 | help_texts.add () = "show macros : all macro definitions"; |
---|
| 2098 | help_texts.add () = "show manager : package manager"; |
---|
| 2099 | help_texts.add () = "show packages : packages reachable from the current context"; |
---|
| 2100 | help_texts.add () = "show path : the package search list"; |
---|
| 2101 | help_texts.add () = "show pattern <name> : the pattern definition and usages"; |
---|
| 2102 | help_texts.add () = "show pattern_names : pattern names"; |
---|
| 2103 | help_texts.add () = "show patterns : the pattern definitions"; |
---|
| 2104 | help_texts.add () = "show projects : project definitions"; |
---|
| 2105 | help_texts.add () = "show setup : setup definitions"; |
---|
| 2106 | help_texts.add () = "show pwd : filtered current directory"; |
---|
| 2107 | help_texts.add () = "show set <name> : a formatted set definition"; |
---|
| 2108 | help_texts.add () = "show set_names : set names"; |
---|
| 2109 | help_texts.add () = "show set_value <name> : a raw set definition"; |
---|
| 2110 | help_texts.add () = "show sets : set definitions"; |
---|
| 2111 | help_texts.add () = "show strategies : all strategies (build & version)"; |
---|
| 2112 | help_texts.add () = "show tags : all currently active tags"; |
---|
| 2113 | help_texts.add () = "show use_paths <pack> : all paths to the used package"; |
---|
| 2114 | help_texts.add () = "show uses : used packages"; |
---|
| 2115 | help_texts.add () = "show version : version of the current package"; |
---|
| 2116 | help_texts.add () = "show versions <name> : visible versions of the selected package"; |
---|
| 2117 | help_texts.add () = "system : display the system tag"; |
---|
| 2118 | help_texts.add () = "unlock [<p> <v> [<path>]] : unlock a package"; |
---|
| 2119 | help_texts.add () = "version : version of CMT"; |
---|
| 2120 | help_texts.add () = ""; |
---|
| 2121 | |
---|
| 2122 | //"build <key> : build various components :" |
---|
| 2123 | //"show <key> : display various infos on :" |
---|
| 2124 | |
---|
| 2125 | help.add (action_none, help_texts[action_none]); |
---|
| 2126 | help.add (action_awk, help_texts[action_awk]); |
---|
| 2127 | help.add (action_broadcast, help_texts[action_broadcast]); |
---|
| 2128 | help.add (action_build, help_texts[action_build]); |
---|
| 2129 | help.add (action_build_constituent_makefile, help_texts[action_build_constituent_makefile]); |
---|
| 2130 | help.add (action_build_constituents_makefile, help_texts[action_build_constituents_makefile]); |
---|
| 2131 | help.add (action_build_dependencies, help_texts[action_build_dependencies]); |
---|
| 2132 | help.add (action_build_library_links, help_texts[action_build_library_links]); |
---|
| 2133 | help.add (action_build_make_setup, help_texts[action_build_make_setup]); |
---|
| 2134 | help.add (action_build_msdev, help_texts[action_build_msdev]); |
---|
| 2135 | help.add (action_build_CMT_pacman, help_texts[action_build_CMT_pacman]); |
---|
| 2136 | help.add (action_build_vsnet, help_texts[action_build_vsnet]); |
---|
| 2137 | help.add (action_build_os9_makefile, help_texts[action_build_os9_makefile]); |
---|
| 2138 | help.add (action_build_prototype, help_texts[action_build_prototype]); |
---|
| 2139 | help.add (action_build_readme, help_texts[action_build_readme]); |
---|
| 2140 | help.add (action_build_tag_makefile, help_texts[action_build_tag_makefile]); |
---|
| 2141 | help.add (action_build_temporary_name, help_texts[action_build_temporary_name]); |
---|
| 2142 | help.add (action_build_triggers, help_texts[action_build_triggers]); |
---|
| 2143 | help.add (action_build_windefs, help_texts[action_build_windefs]); |
---|
| 2144 | help.add (action_check_configuration, help_texts[action_check_configuration]); |
---|
| 2145 | help.add (action_check_files, help_texts[action_check_files]); |
---|
| 2146 | help.add (action_check_version, help_texts[action_check_version]); |
---|
| 2147 | help.add (action_checkout, help_texts[action_checkout]); |
---|
| 2148 | help.add (action_cleanup, help_texts[action_cleanup]); |
---|
| 2149 | help.add (action_config, help_texts[action_config]); |
---|
| 2150 | help.add (action_create, help_texts[action_create]); |
---|
| 2151 | help.add (action_create_project, help_texts[action_create_project]); |
---|
| 2152 | help.add (action_cvsbranches, help_texts[action_cvsbranches]); |
---|
| 2153 | help.add (action_cvssubpackages, help_texts[action_cvssubpackages]); |
---|
| 2154 | help.add (action_cvstags, help_texts[action_cvstags]); |
---|
| 2155 | help.add (action_do, help_texts[action_do]); |
---|
| 2156 | help.add (action_expand_model, help_texts[action_expand_model]); |
---|
| 2157 | help.add (action_filter, help_texts[action_filter]); |
---|
| 2158 | help.add (action_help, help_texts[action_help]); |
---|
| 2159 | help.add (action_load, help_texts[action_load]); |
---|
| 2160 | help.add (action_lock, help_texts[action_lock]); |
---|
| 2161 | help.add (action_remove, help_texts[action_remove]); |
---|
| 2162 | help.add (action_remove_library_links, help_texts[action_remove_library_links]); |
---|
| 2163 | help.add (action_run, help_texts[action_run]); |
---|
| 2164 | help.add (action_run_sequence, help_texts[action_run_sequence]); |
---|
| 2165 | help.add (action_set_version, help_texts[action_set_version]); |
---|
| 2166 | help.add (action_set_versions, help_texts[action_set_versions]); |
---|
| 2167 | help.add (action_setup, help_texts[action_setup]); |
---|
| 2168 | help.add (action_show, help_texts[action_show]); |
---|
| 2169 | help.add (action_show_action, help_texts[action_show_action]); |
---|
| 2170 | help.add (action_show_action_value, help_texts[action_show_action_value]); |
---|
| 2171 | help.add (action_show_action_names, help_texts[action_show_action_names]); |
---|
| 2172 | help.add (action_show_actions, help_texts[action_show_actions]); |
---|
| 2173 | help.add (action_show_all_tags, help_texts[action_show_all_tags]); |
---|
| 2174 | help.add (action_show_applied_patterns, help_texts[action_show_applied_patterns]); |
---|
| 2175 | help.add (action_show_author, help_texts[action_show_author]); |
---|
| 2176 | help.add (action_show_branches, help_texts[action_show_branches]); |
---|
| 2177 | help.add (action_show_clients, help_texts[action_show_clients]); |
---|
| 2178 | help.add (action_show_cmtpath_patterns, help_texts[action_show_cmtpath_patterns]); |
---|
| 2179 | help.add (action_show_constituent, help_texts[action_show_constituent]); |
---|
| 2180 | help.add (action_show_constituent_names, help_texts[action_show_constituent_names]); |
---|
| 2181 | help.add (action_show_constituents, help_texts[action_show_constituents]); |
---|
| 2182 | help.add (action_show_cycles, help_texts[action_show_cycles]); |
---|
| 2183 | help.add (action_show_fragment, help_texts[action_show_fragment]); |
---|
| 2184 | help.add (action_show_fragments, help_texts[action_show_fragments]); |
---|
| 2185 | help.add (action_show_groups, help_texts[action_show_groups]); |
---|
| 2186 | help.add (action_show_include_dirs, help_texts[action_show_include_dirs]); |
---|
| 2187 | help.add (action_show_language, help_texts[action_show_language]); |
---|
| 2188 | help.add (action_show_languages, help_texts[action_show_languages]); |
---|
| 2189 | help.add (action_show_macro, help_texts[action_show_macro]); |
---|
| 2190 | help.add (action_show_macro_value, help_texts[action_show_macro_value]); |
---|
| 2191 | help.add (action_show_macro_names, help_texts[action_show_macro_names]); |
---|
| 2192 | help.add (action_show_macros, help_texts[action_show_macros]); |
---|
| 2193 | help.add (action_show_manager, help_texts[action_show_manager]); |
---|
| 2194 | help.add (action_show_packages, help_texts[action_show_packages]); |
---|
| 2195 | help.add (action_show_path, help_texts[action_show_path]); |
---|
| 2196 | help.add (action_show_pattern, help_texts[action_show_pattern]); |
---|
| 2197 | help.add (action_show_pattern_names, help_texts[action_show_pattern_names]); |
---|
| 2198 | help.add (action_show_patterns, help_texts[action_show_patterns]); |
---|
| 2199 | help.add (action_show_projects, help_texts[action_show_projects]); |
---|
| 2200 | help.add (action_show_setup, help_texts[action_show_setup]); |
---|
| 2201 | help.add (action_show_pwd, help_texts[action_show_pwd]); |
---|
| 2202 | help.add (action_show_set, help_texts[action_show_set]); |
---|
| 2203 | help.add (action_show_set_names, help_texts[action_show_set_names]); |
---|
| 2204 | help.add (action_show_set_value, help_texts[action_show_set_value]); |
---|
| 2205 | help.add (action_show_sets, help_texts[action_show_sets]); |
---|
| 2206 | help.add (action_show_strategies, help_texts[action_show_strategies]); |
---|
| 2207 | help.add (action_show_tags, help_texts[action_show_tags]); |
---|
| 2208 | help.add (action_show_use_paths, help_texts[action_show_use_paths]); |
---|
| 2209 | help.add (action_show_uses, help_texts[action_show_uses]); |
---|
| 2210 | help.add (action_show_version, help_texts[action_show_version]); |
---|
| 2211 | help.add (action_show_versions, help_texts[action_show_versions]); |
---|
| 2212 | help.add (action_system, help_texts[action_system]); |
---|
| 2213 | help.add (action_unlock, help_texts[action_unlock]); |
---|
| 2214 | help.add (action_version, help_texts[action_version]); |
---|
| 2215 | } |
---|
| 2216 | |
---|