[2] | 1 | //----------------------------------------------------------- |
---|
| 2 | // Copyright Christian Arnault LAL-Orsay CNRS |
---|
| 3 | // arnault@lal.in2p3.fr |
---|
[272] | 4 | // Modified by garonne@lal.in2p3.fr |
---|
[663] | 5 | // Modified by Grigory Rybkin |
---|
[2] | 6 | // See the complete license in cmt_license.txt "http://www.cecill.info". |
---|
| 7 | //----------------------------------------------------------- |
---|
| 8 | |
---|
| 9 | #include "cmt_commands.h" |
---|
| 10 | #include "cmt_tag.h" |
---|
| 11 | #include "cmt_symbol.h" |
---|
| 12 | #include "cmt_project.h" |
---|
[459] | 13 | #include "cmt_log.h" |
---|
[496] | 14 | #include "cmt_error.h" |
---|
[2] | 15 | |
---|
| 16 | ArgParser::ArgParser (CmtContext& context) : cmt(context), argc(0), argv(0), mode(Csh) |
---|
| 17 | { |
---|
| 18 | arguments.clear (); |
---|
| 19 | |
---|
| 20 | int i = 0; |
---|
| 21 | |
---|
| 22 | parsers.add ("awk", i); |
---|
| 23 | pv.push_back (&ArgParser::do_awk); i++; |
---|
| 24 | |
---|
| 25 | parsers.add ("br", i); |
---|
| 26 | parsers.add ("bro", i); |
---|
| 27 | parsers.add ("broa", i); |
---|
| 28 | parsers.add ("broad", i); |
---|
| 29 | parsers.add ("broadc", i); |
---|
| 30 | parsers.add ("broadca", i); |
---|
| 31 | parsers.add ("broadcas", i); |
---|
| 32 | parsers.add ("broadcast", i); |
---|
| 33 | pv.push_back (&ArgParser::do_broadcast); i++; |
---|
| 34 | |
---|
| 35 | parsers.add ("bu", i); |
---|
| 36 | parsers.add ("bui", i); |
---|
| 37 | parsers.add ("buil", i); |
---|
| 38 | parsers.add ("build", i); |
---|
| 39 | pv.push_back (&ArgParser::do_build); i++; |
---|
| 40 | |
---|
| 41 | parsers.add ("check", i); |
---|
| 42 | pv.push_back (&ArgParser::do_check); i++; |
---|
| 43 | |
---|
| 44 | parsers.add ("check_f", i); |
---|
| 45 | parsers.add ("check_fi", i); |
---|
| 46 | parsers.add ("check_fil", i); |
---|
| 47 | parsers.add ("check_file", i); |
---|
| 48 | parsers.add ("check_files", i); |
---|
| 49 | pv.push_back (&ArgParser::do_check_files); i++; |
---|
| 50 | |
---|
| 51 | parsers.add ("co", i); |
---|
| 52 | parsers.add ("checkout", i); |
---|
| 53 | pv.push_back (&ArgParser::do_checkout); i++; |
---|
| 54 | |
---|
| 55 | parsers.add ("cl", i); |
---|
| 56 | parsers.add ("cle", i); |
---|
| 57 | parsers.add ("clea", i); |
---|
| 58 | parsers.add ("clean", i); |
---|
| 59 | parsers.add ("cleanu", i); |
---|
| 60 | parsers.add ("cleanup", i); |
---|
| 61 | pv.push_back (&ArgParser::do_cleanup); i++; |
---|
| 62 | |
---|
| 63 | parsers.add ("con", i); |
---|
| 64 | parsers.add ("conf", i); |
---|
| 65 | parsers.add ("confi", i); |
---|
| 66 | parsers.add ("config", i); |
---|
| 67 | pv.push_back (&ArgParser::do_config); i++; |
---|
| 68 | |
---|
| 69 | parsers.add ("create", i); |
---|
| 70 | pv.push_back (&ArgParser::do_create); i++; |
---|
| 71 | |
---|
| 72 | parsers.add ("create_project", i); |
---|
| 73 | pv.push_back (&ArgParser::do_create_project); i++; |
---|
| 74 | |
---|
| 75 | parsers.add ("cvsb", i); |
---|
| 76 | parsers.add ("cvsbr", i); |
---|
| 77 | parsers.add ("cvsbra", i); |
---|
| 78 | parsers.add ("cvsbran", i); |
---|
| 79 | parsers.add ("cvsbranc", i); |
---|
| 80 | parsers.add ("cvsbranch", i); |
---|
| 81 | parsers.add ("cvsbranche", i); |
---|
| 82 | parsers.add ("cvsbranches", i); |
---|
| 83 | pv.push_back (&ArgParser::do_cvsbranches); i++; |
---|
| 84 | |
---|
| 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 | |
---|
[42] | 94 | parsers.add ("cvssubpr", i); |
---|
| 95 | parsers.add ("cvssubpro", i); |
---|
| 96 | parsers.add ("cvssubproj", i); |
---|
| 97 | parsers.add ("cvssubproje", i); |
---|
| 98 | parsers.add ("cvssubprojec", i); |
---|
| 99 | parsers.add ("cvssubproject", i); |
---|
| 100 | parsers.add ("cvssubprojects", i); |
---|
| 101 | pv.push_back (&ArgParser::do_cvssubprojects); i++; |
---|
| 102 | |
---|
[2] | 103 | parsers.add ("cvst", i); |
---|
| 104 | parsers.add ("cvsta", i); |
---|
| 105 | parsers.add ("cvstag", i); |
---|
| 106 | parsers.add ("cvstags", i); |
---|
| 107 | pv.push_back (&ArgParser::do_cvstags); i++; |
---|
| 108 | |
---|
| 109 | parsers.add ("d", i); |
---|
| 110 | parsers.add ("do", i); |
---|
| 111 | pv.push_back (&ArgParser::do_do); i++; |
---|
| 112 | |
---|
| 113 | parsers.add ("e", i); |
---|
| 114 | parsers.add ("ex", i); |
---|
| 115 | parsers.add ("exp", i); |
---|
| 116 | parsers.add ("expa", i); |
---|
| 117 | parsers.add ("expan", i); |
---|
| 118 | parsers.add ("expand", i); |
---|
| 119 | pv.push_back (&ArgParser::do_expand); i++; |
---|
| 120 | |
---|
| 121 | parsers.add ("f", i); |
---|
| 122 | parsers.add ("fi", i); |
---|
| 123 | parsers.add ("fil", i); |
---|
| 124 | parsers.add ("filt", i); |
---|
| 125 | parsers.add ("filte", i); |
---|
| 126 | parsers.add ("filter", i); |
---|
| 127 | pv.push_back (&ArgParser::do_filter); i++; |
---|
| 128 | |
---|
| 129 | parsers.add ("h", i); |
---|
| 130 | parsers.add ("he", i); |
---|
| 131 | parsers.add ("hel", i); |
---|
| 132 | parsers.add ("help", i); |
---|
| 133 | pv.push_back (&ArgParser::do_help); i++; |
---|
| 134 | |
---|
| 135 | parsers.add ("l", i); |
---|
| 136 | parsers.add ("lo", i); |
---|
| 137 | parsers.add ("loc", i); |
---|
| 138 | parsers.add ("lock", i); |
---|
| 139 | pv.push_back (&ArgParser::do_lock); i++; |
---|
| 140 | |
---|
[181] | 141 | parsers.add ("rel", i); |
---|
| 142 | parsers.add ("relo", i); |
---|
| 143 | parsers.add ("reloc", i); |
---|
| 144 | parsers.add ("reloca", i); |
---|
| 145 | parsers.add ("relocat", i); |
---|
| 146 | parsers.add ("relocate", i); |
---|
| 147 | pv.push_back (&ArgParser::do_relocate); i++; |
---|
| 148 | |
---|
[2] | 149 | parsers.add ("rem", i); |
---|
| 150 | parsers.add ("remo", i); |
---|
| 151 | parsers.add ("remov", i); |
---|
| 152 | parsers.add ("remove", i); |
---|
| 153 | pv.push_back (&ArgParser::do_remove); i++; |
---|
| 154 | |
---|
| 155 | parsers.add ("run", i); |
---|
| 156 | pv.push_back (&ArgParser::do_run); i++; |
---|
| 157 | |
---|
| 158 | parsers.add ("run_sequence", i); |
---|
| 159 | pv.push_back (&ArgParser::do_run_sequence); i++; |
---|
| 160 | |
---|
| 161 | parsers.add ("set", i); |
---|
| 162 | pv.push_back (&ArgParser::do_set); i++; |
---|
| 163 | |
---|
| 164 | parsers.add ("setup", i); |
---|
| 165 | pv.push_back (&ArgParser::do_setup); i++; |
---|
| 166 | |
---|
| 167 | parsers.add ("sh", i); |
---|
| 168 | parsers.add ("sho", i); |
---|
| 169 | parsers.add ("show", i); |
---|
| 170 | pv.push_back (&ArgParser::do_show); i++; |
---|
| 171 | |
---|
| 172 | parsers.add ("sy", i); |
---|
| 173 | parsers.add ("sys", i); |
---|
| 174 | parsers.add ("syst", i); |
---|
| 175 | parsers.add ("syste", i); |
---|
| 176 | parsers.add ("system", i); |
---|
| 177 | pv.push_back (&ArgParser::do_system); i++; |
---|
| 178 | |
---|
| 179 | parsers.add ("u", i); |
---|
| 180 | parsers.add ("un", i); |
---|
| 181 | parsers.add ("unl", i); |
---|
| 182 | parsers.add ("unlo", i); |
---|
| 183 | parsers.add ("unloc", i); |
---|
| 184 | parsers.add ("unlock", i); |
---|
| 185 | pv.push_back (&ArgParser::do_unlock); i++; |
---|
| 186 | |
---|
| 187 | parsers.add ("v", i); |
---|
| 188 | parsers.add ("ve", i); |
---|
| 189 | parsers.add ("ver", i); |
---|
| 190 | parsers.add ("vers", i); |
---|
| 191 | parsers.add ("versi", i); |
---|
| 192 | parsers.add ("versio", i); |
---|
| 193 | parsers.add ("version", i); |
---|
| 194 | parsers.add ("--version", i); |
---|
| 195 | pv.push_back (&ArgParser::do_version); i++; |
---|
| 196 | |
---|
| 197 | parsers.add ("-b", i); |
---|
| 198 | parsers.add ("-ba", i); |
---|
| 199 | parsers.add ("-bat", i); |
---|
| 200 | pv.push_back (&ArgParser::option_bat); i++; |
---|
| 201 | |
---|
| 202 | parsers.add ("-c", i); |
---|
| 203 | parsers.add ("-cs", i); |
---|
| 204 | parsers.add ("-csh", i); |
---|
| 205 | pv.push_back (&ArgParser::option_csh); i++; |
---|
| 206 | |
---|
[282] | 207 | parsers.add ("-d", i); |
---|
| 208 | parsers.add ("-di", i); |
---|
| 209 | parsers.add ("-dis", i); |
---|
| 210 | parsers.add ("-disa", i); |
---|
| 211 | parsers.add ("-disab", i); |
---|
| 212 | parsers.add ("-disabl", i); |
---|
| 213 | parsers.add ("-disable", i); |
---|
| 214 | parsers.add ("-disable_", i); |
---|
| 215 | parsers.add ("-disable_w", i); |
---|
| 216 | parsers.add ("-disable_wa", i); |
---|
| 217 | parsers.add ("-disable_war", i); |
---|
| 218 | parsers.add ("-disable_warn", i); |
---|
| 219 | parsers.add ("-disable_warni", i); |
---|
| 220 | parsers.add ("-disable_warnin", i); |
---|
| 221 | parsers.add ("-disable_warning", i); |
---|
| 222 | parsers.add ("-disable_warnings", i); |
---|
| 223 | pv.push_back (&ArgParser::option_disable_warnings); i++; |
---|
| 224 | //Cmt::get_quiet () |
---|
| 225 | |
---|
[2] | 226 | parsers.add ("-e", i); |
---|
| 227 | pv.push_back (&ArgParser::option_e); i++; |
---|
| 228 | |
---|
| 229 | parsers.add ("-f", i); |
---|
| 230 | pv.push_back (&ArgParser::option_f); i++; |
---|
| 231 | |
---|
| 232 | parsers.add ("-h", i); |
---|
| 233 | parsers.add ("-he", i); |
---|
| 234 | parsers.add ("-hel", i); |
---|
| 235 | parsers.add ("-help", i); |
---|
| 236 | parsers.add ("--h", i); |
---|
| 237 | parsers.add ("--he", i); |
---|
| 238 | parsers.add ("--hel", i); |
---|
| 239 | parsers.add ("--help", i); |
---|
| 240 | pv.push_back (&ArgParser::option_help); i++; |
---|
| 241 | |
---|
| 242 | parsers.add ("-ho", i); |
---|
| 243 | parsers.add ("-hom", i); |
---|
| 244 | parsers.add ("-home", i); |
---|
| 245 | pv.push_back (&ArgParser::option_home); i++; |
---|
| 246 | |
---|
| 247 | parsers.add ("-n", i); |
---|
| 248 | pv.push_back (&ArgParser::option_n); i++; |
---|
| 249 | |
---|
| 250 | parsers.add ("-no_c", i); |
---|
| 251 | parsers.add ("-no_cl", i); |
---|
| 252 | parsers.add ("-no_cle", i); |
---|
| 253 | parsers.add ("-no_clea", i); |
---|
| 254 | parsers.add ("-no_clean", i); |
---|
| 255 | parsers.add ("-no_cleanu", i); |
---|
| 256 | parsers.add ("-no_cleanup", i); |
---|
| 257 | pv.push_back (&ArgParser::option_no_cleanup); i++; |
---|
| 258 | |
---|
[659] | 259 | parsers.add ("-no_strip_p", i); |
---|
| 260 | parsers.add ("-no_strip_pa", i); |
---|
| 261 | parsers.add ("-no_strip_pat", i); |
---|
| 262 | parsers.add ("-no_strip_path", i); |
---|
| 263 | pv.push_back (&ArgParser::option_no_strip_path); i++; |
---|
[656] | 264 | |
---|
[2] | 265 | parsers.add ("-pac", i); |
---|
| 266 | parsers.add ("-pack", i); |
---|
| 267 | pv.push_back (&ArgParser::option_pack); i++; |
---|
| 268 | |
---|
| 269 | parsers.add ("-pat", i); |
---|
| 270 | parsers.add ("-path", i); |
---|
| 271 | pv.push_back (&ArgParser::option_path); i++; |
---|
| 272 | |
---|
[659] | 273 | parsers.add ("-strip_p", i); |
---|
| 274 | parsers.add ("-strip_pa", i); |
---|
| 275 | parsers.add ("-strip_pat", i); |
---|
| 276 | parsers.add ("-strip_path", i); |
---|
| 277 | pv.push_back (&ArgParser::option_strip_path); i++; |
---|
[656] | 278 | |
---|
[2] | 279 | parsers.add ("-pr", i); |
---|
| 280 | parsers.add ("-pri", i); |
---|
| 281 | parsers.add ("-priv", i); |
---|
| 282 | parsers.add ("-priva", i); |
---|
| 283 | parsers.add ("-privat", i); |
---|
| 284 | parsers.add ("-private", i); |
---|
| 285 | pv.push_back (&ArgParser::option_private); i++; |
---|
| 286 | |
---|
| 287 | parsers.add ("-pu", i); |
---|
| 288 | parsers.add ("-pub", i); |
---|
| 289 | parsers.add ("-publ", i); |
---|
| 290 | parsers.add ("-publi", i); |
---|
| 291 | parsers.add ("-public", i); |
---|
| 292 | pv.push_back (&ArgParser::option_public); i++; |
---|
| 293 | |
---|
[549] | 294 | parsers.add ("-cmt", i); |
---|
| 295 | parsers.add ("-req", i); |
---|
| 296 | parsers.add ("-requ", i); |
---|
| 297 | parsers.add ("-requi", i); |
---|
| 298 | parsers.add ("-requir", i); |
---|
| 299 | parsers.add ("-require", i); |
---|
| 300 | parsers.add ("-requirem", i); |
---|
| 301 | parsers.add ("-requireme", i); |
---|
| 302 | parsers.add ("-requiremen", i); |
---|
| 303 | parsers.add ("-requirement", i); |
---|
| 304 | parsers.add ("-requirements", i); |
---|
| 305 | pv.push_back (&ArgParser::option_requirements); i++; |
---|
| 306 | |
---|
[2] | 307 | parsers.add ("-s", i); |
---|
| 308 | parsers.add ("-sh", i); |
---|
| 309 | pv.push_back (&ArgParser::option_sh); i++; |
---|
| 310 | |
---|
| 311 | parsers.add ("-q", i); |
---|
| 312 | parsers.add ("-qu", i); |
---|
| 313 | parsers.add ("-qui", i); |
---|
| 314 | parsers.add ("-quie", i); |
---|
| 315 | parsers.add ("-quiet", i); |
---|
| 316 | pv.push_back (&ArgParser::option_quiet); i++; |
---|
| 317 | |
---|
| 318 | parsers.add ("-tag", i); |
---|
| 319 | pv.push_back (&ArgParser::option_tag); i++; |
---|
| 320 | |
---|
| 321 | parsers.add ("-tag_add", i); |
---|
| 322 | pv.push_back (&ArgParser::option_tag_add); i++; |
---|
| 323 | |
---|
| 324 | parsers.add ("-tag_remove", i); |
---|
| 325 | pv.push_back (&ArgParser::option_tag_remove); i++; |
---|
| 326 | |
---|
| 327 | parsers.add ("-u", i); |
---|
| 328 | parsers.add ("-us", i); |
---|
| 329 | parsers.add ("-use", i); |
---|
| 330 | pv.push_back (&ArgParser::option_use); i++; |
---|
| 331 | |
---|
| 332 | parsers.add ("-user", i); |
---|
| 333 | parsers.add ("-user_", i); |
---|
| 334 | parsers.add ("-user_c", i); |
---|
| 335 | parsers.add ("-user_co", i); |
---|
| 336 | parsers.add ("-user_con", i); |
---|
| 337 | parsers.add ("-user_cont", i); |
---|
| 338 | parsers.add ("-user_conte", i); |
---|
| 339 | parsers.add ("-user_contex", i); |
---|
| 340 | parsers.add ("-user_context", i); |
---|
| 341 | pv.push_back (&ArgParser::option_user_context); i++; |
---|
| 342 | |
---|
| 343 | parsers.add ("-v", i); |
---|
| 344 | parsers.add ("-ve", i); |
---|
| 345 | parsers.add ("-ver", i); |
---|
| 346 | parsers.add ("-vers", i); |
---|
| 347 | parsers.add ("-versi", i); |
---|
| 348 | parsers.add ("-versio", i); |
---|
| 349 | parsers.add ("-version", i); |
---|
| 350 | pv.push_back (&ArgParser::option_version); i++; |
---|
| 351 | |
---|
[561] | 352 | parsers.add ("-with_c", i); |
---|
| 353 | parsers.add ("-with_cm", i); |
---|
| 354 | parsers.add ("-with_cmt", i); |
---|
| 355 | pv.push_back (&ArgParser::option_with_cmt); i++; |
---|
| 356 | |
---|
| 357 | parsers.add ("-without_c", i); |
---|
| 358 | parsers.add ("-without_cm", i); |
---|
| 359 | parsers.add ("-without_cmt", i); |
---|
| 360 | pv.push_back (&ArgParser::option_without_cmt); i++; |
---|
| 361 | |
---|
[656] | 362 | parsers.add ("-with_p", i); |
---|
| 363 | parsers.add ("-with_pr", i); |
---|
| 364 | parsers.add ("-with_pro", i); |
---|
| 365 | parsers.add ("-with_proj", i); |
---|
| 366 | parsers.add ("-with_proje", i); |
---|
| 367 | parsers.add ("-with_projec", i); |
---|
| 368 | parsers.add ("-with_project", i); |
---|
| 369 | parsers.add ("-with_projects", i); |
---|
| 370 | pv.push_back (&ArgParser::option_with_projects); i++; |
---|
| 371 | |
---|
| 372 | parsers.add ("-without_p", i); |
---|
| 373 | parsers.add ("-without_pr", i); |
---|
| 374 | parsers.add ("-without_pro", i); |
---|
| 375 | parsers.add ("-without_proj", i); |
---|
| 376 | parsers.add ("-without_proje", i); |
---|
| 377 | parsers.add ("-without_projec", i); |
---|
| 378 | parsers.add ("-without_project", i); |
---|
| 379 | parsers.add ("-without_projects", i); |
---|
| 380 | pv.push_back (&ArgParser::option_without_projects); i++; |
---|
| 381 | |
---|
[109] | 382 | parsers.add ("-warn", i); |
---|
| 383 | parsers.add ("-warni", i); |
---|
| 384 | parsers.add ("-warnin", i); |
---|
| 385 | parsers.add ("-warning", i); |
---|
| 386 | parsers.add ("-warnings", i); |
---|
| 387 | pv.push_back (&ArgParser::option_warnings); i++; |
---|
| 388 | |
---|
[2] | 389 | parsers.add ("-with_v", i); |
---|
| 390 | parsers.add ("-with_ve", i); |
---|
| 391 | parsers.add ("-with_ver", i); |
---|
| 392 | parsers.add ("-with_vers", i); |
---|
| 393 | parsers.add ("-with_versi", i); |
---|
| 394 | parsers.add ("-with_versio", i); |
---|
| 395 | parsers.add ("-with_version", i); |
---|
| 396 | parsers.add ("-with_version_", i); |
---|
| 397 | parsers.add ("-with_version_d", i); |
---|
| 398 | parsers.add ("-with_version_di", i); |
---|
| 399 | parsers.add ("-with_version_dir", i); |
---|
| 400 | parsers.add ("-with_version_dire", i); |
---|
| 401 | parsers.add ("-with_version_direc", i); |
---|
| 402 | parsers.add ("-with_version_direct", i); |
---|
| 403 | parsers.add ("-with_version_directo", i); |
---|
| 404 | parsers.add ("-with_version_director", i); |
---|
| 405 | parsers.add ("-with_version_directory", i); |
---|
| 406 | pv.push_back (&ArgParser::option_with_version_directory); i++; |
---|
| 407 | |
---|
| 408 | parsers.add ("-without_v", i); |
---|
| 409 | parsers.add ("-without_ve", i); |
---|
| 410 | parsers.add ("-without_ver", i); |
---|
| 411 | parsers.add ("-without_vers", i); |
---|
| 412 | parsers.add ("-without_versi", i); |
---|
| 413 | parsers.add ("-without_versio", i); |
---|
| 414 | parsers.add ("-without_version", i); |
---|
| 415 | parsers.add ("-without_version_", i); |
---|
| 416 | parsers.add ("-without_version_d", i); |
---|
| 417 | parsers.add ("-without_version_di", i); |
---|
| 418 | parsers.add ("-without_version_dir", i); |
---|
| 419 | parsers.add ("-without_version_dire", i); |
---|
| 420 | parsers.add ("-without_version_direc", i); |
---|
| 421 | parsers.add ("-without_version_direct", i); |
---|
| 422 | parsers.add ("-without_version_directo", i); |
---|
| 423 | parsers.add ("-without_version_director", i); |
---|
| 424 | parsers.add ("-without_version_directory", i); |
---|
| 425 | pv.push_back (&ArgParser::option_without_version_directory); i++; |
---|
| 426 | |
---|
[550] | 427 | parsers.add ("-xml", i); |
---|
| 428 | pv.push_back (&ArgParser::option_xml); i++; |
---|
[2] | 429 | } |
---|
| 430 | |
---|
| 431 | void ArgParser::shift () |
---|
| 432 | { |
---|
| 433 | if (argc > 0) |
---|
| 434 | { |
---|
| 435 | argc--; |
---|
| 436 | argv++; |
---|
| 437 | } |
---|
| 438 | } |
---|
| 439 | |
---|
| 440 | void ArgParser::unshift () |
---|
| 441 | { |
---|
| 442 | argc++; |
---|
| 443 | argv--; |
---|
| 444 | } |
---|
| 445 | |
---|
| 446 | void ArgParser::fill_arguments () |
---|
| 447 | { |
---|
| 448 | while (argc > 0) |
---|
| 449 | { |
---|
| 450 | cmt_string& s = arguments.add (); |
---|
| 451 | s = argv[0]; |
---|
| 452 | |
---|
| 453 | //cerr << "Getting arg[" << s << "] " << endl; |
---|
| 454 | |
---|
| 455 | shift (); |
---|
| 456 | } |
---|
| 457 | } |
---|
| 458 | |
---|
| 459 | cmt_string& ArgParser::fill_one_argument () |
---|
| 460 | { |
---|
| 461 | if (argc > 0) |
---|
| 462 | { |
---|
| 463 | cmt_string& s = arguments.add (); |
---|
| 464 | s = argv[0]; |
---|
| 465 | |
---|
| 466 | //cerr << "Getting arg[" << s << "] " << endl; |
---|
| 467 | |
---|
| 468 | shift (); |
---|
| 469 | |
---|
| 470 | return (s); |
---|
| 471 | } |
---|
| 472 | else |
---|
| 473 | { |
---|
| 474 | static cmt_string empty = ""; |
---|
| 475 | return (empty); |
---|
| 476 | } |
---|
| 477 | } |
---|
| 478 | |
---|
| 479 | cmt_string& ArgParser::fill_one_argument_filtered () |
---|
| 480 | { |
---|
| 481 | if (argc > 0) |
---|
| 482 | { |
---|
| 483 | cmt_string& s = arguments.add (); |
---|
| 484 | s = argv[0]; |
---|
| 485 | |
---|
| 486 | if (s[0] == '-') |
---|
| 487 | { |
---|
| 488 | s = ""; |
---|
| 489 | } |
---|
| 490 | |
---|
| 491 | //cerr << "Getting arg[" << s << "] " << endl; |
---|
| 492 | |
---|
| 493 | shift (); |
---|
| 494 | |
---|
| 495 | return (s); |
---|
| 496 | } |
---|
| 497 | else |
---|
| 498 | { |
---|
| 499 | static cmt_string empty = ""; |
---|
| 500 | return (empty); |
---|
| 501 | } |
---|
| 502 | } |
---|
| 503 | |
---|
| 504 | void ArgParser::parse () |
---|
| 505 | { |
---|
| 506 | ArgParser& me = *this; |
---|
| 507 | |
---|
| 508 | help_action = action_none; |
---|
| 509 | arguments.clear (); |
---|
| 510 | extra_line.erase (0); |
---|
| 511 | extra_file.erase (0); |
---|
| 512 | mode = Csh; |
---|
| 513 | |
---|
| 514 | /// Skip first argument ("cmt") |
---|
| 515 | shift (); |
---|
| 516 | |
---|
[3] | 517 | cmt.m_action = action_none; |
---|
| 518 | |
---|
[2] | 519 | while (argc > 0) |
---|
| 520 | { |
---|
| 521 | arg = argv[0]; |
---|
| 522 | |
---|
| 523 | shift (); |
---|
| 524 | |
---|
| 525 | /// Suppress trailing carriage-return |
---|
| 526 | int cr = arg.find ('\r'); |
---|
| 527 | if (cr != cmt_string::npos) arg.erase (cr); |
---|
| 528 | |
---|
| 529 | /// Suppress enclosing quotes |
---|
| 530 | if ((arg[0] == '\"') && (arg[arg.size () - 1] == '\"')) |
---|
| 531 | { |
---|
| 532 | arg.erase (0, 1); |
---|
| 533 | arg.erase (arg.size () - 1, 1); |
---|
| 534 | } |
---|
| 535 | |
---|
| 536 | /// Detect and split arguments of the form a=b |
---|
| 537 | /// left and right part of this argument |
---|
| 538 | cmt_string reduced_arg = arg; |
---|
| 539 | int pos = reduced_arg.find ('='); |
---|
| 540 | if (pos != cmt_string::npos) |
---|
| 541 | { |
---|
| 542 | reduced_arg.erase (pos); |
---|
| 543 | arg.erase (0, pos+1); |
---|
| 544 | } |
---|
| 545 | else |
---|
| 546 | { |
---|
| 547 | arg = ""; |
---|
| 548 | } |
---|
| 549 | |
---|
[329] | 550 | // cerr << "argc=" << argc << " reduced_arg=[" << reduced_arg << "] arg=[" << arg << "]" << endl; |
---|
[2] | 551 | |
---|
| 552 | if (parsers.has (reduced_arg)) |
---|
| 553 | { |
---|
[3] | 554 | // This argument corresponds to a known command |
---|
| 555 | |
---|
[2] | 556 | int i = (*parsers.find (reduced_arg)); |
---|
| 557 | |
---|
| 558 | parser p = pv[i]; |
---|
| 559 | (me.*p) (); |
---|
| 560 | } |
---|
[3] | 561 | else if (cmt.m_action != action_none) |
---|
| 562 | { |
---|
| 563 | // We have unexpected arguments (not handled by the command handler). This may sign |
---|
| 564 | // an unprotected handler implementation. |
---|
[561] | 565 | if (help_action != action_help) |
---|
| 566 | CmtMessage::warning ("unexpected parameter " + reduced_arg); |
---|
[459] | 567 | // if (!cmt.m_quiet) cerr << "#CMT> warning : unexpected parameter " << reduced_arg << endl; |
---|
[3] | 568 | } |
---|
[2] | 569 | else |
---|
| 570 | { |
---|
[3] | 571 | // This argument does not correspond to a known command. We expect then an action |
---|
| 572 | // to be executed with that name |
---|
| 573 | |
---|
[2] | 574 | unshift (); |
---|
| 575 | do_do (); |
---|
| 576 | |
---|
| 577 | /* |
---|
| 578 | if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad command parameter " << arg << endl; |
---|
| 579 | help_action = action_none; |
---|
| 580 | */ |
---|
| 581 | } |
---|
| 582 | } |
---|
| 583 | } |
---|
| 584 | |
---|
| 585 | void ArgParser::do_awk () |
---|
| 586 | { |
---|
| 587 | fill_arguments (); |
---|
| 588 | cmt.m_action = action_awk; |
---|
| 589 | } |
---|
| 590 | |
---|
| 591 | void ArgParser::do_broadcast () |
---|
| 592 | { |
---|
| 593 | fill_arguments (); |
---|
| 594 | cmt.m_action = action_broadcast; |
---|
| 595 | |
---|
| 596 | if (cmt.m_scope_filtering_mode == default_filtering_mode) |
---|
| 597 | { |
---|
| 598 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 599 | } |
---|
| 600 | } |
---|
| 601 | |
---|
| 602 | void ArgParser::do_build () |
---|
| 603 | { |
---|
| 604 | if (argc > 0) |
---|
| 605 | { |
---|
| 606 | arg = argv[0]; |
---|
| 607 | |
---|
| 608 | if (arg == "-nmake") |
---|
| 609 | { |
---|
| 610 | cmt.m_build_nmake = true; |
---|
| 611 | shift (); |
---|
| 612 | } |
---|
| 613 | } |
---|
| 614 | |
---|
| 615 | if (argc > 0) |
---|
| 616 | { |
---|
| 617 | arg = argv[0]; |
---|
| 618 | |
---|
| 619 | shift (); |
---|
| 620 | |
---|
| 621 | if (arg == "constituent_makefile") |
---|
| 622 | { |
---|
[561] | 623 | cmt.m_action = action_build_constituent_makefile; |
---|
| 624 | bool need_name (true); |
---|
| 625 | while (argc > 0) |
---|
[2] | 626 | { |
---|
[561] | 627 | cmt_string arg(argv[0]); |
---|
| 628 | if (arg.substr (0, 5) == "-out=") |
---|
| 629 | { |
---|
| 630 | fill_one_argument (); |
---|
| 631 | } |
---|
| 632 | else if (arg == "-with_cmt") |
---|
| 633 | { |
---|
| 634 | shift (); |
---|
| 635 | cmt.m_use_cmt = true; |
---|
| 636 | } |
---|
| 637 | else if (arg == "-without_cmt") |
---|
| 638 | { |
---|
| 639 | shift (); |
---|
| 640 | cmt.m_use_cmt = false; |
---|
| 641 | } |
---|
| 642 | else if (need_name && arg != "") |
---|
| 643 | { |
---|
| 644 | need_name = false; |
---|
| 645 | fill_one_argument (); |
---|
| 646 | } |
---|
| 647 | else |
---|
| 648 | { |
---|
| 649 | help_action = action_help; |
---|
| 650 | CmtError::set (CmtError::syntax_error, arg + ": wrong argument"); |
---|
| 651 | break; |
---|
| 652 | } |
---|
[2] | 653 | } |
---|
[561] | 654 | if (need_name) |
---|
[428] | 655 | { |
---|
| 656 | help_action = action_help; |
---|
[561] | 657 | if (!CmtError::has_pending_error ()) |
---|
| 658 | CmtError::set (CmtError::syntax_error, "argument(s) missing"); |
---|
[428] | 659 | } |
---|
[2] | 660 | } |
---|
[547] | 661 | else if (arg == "constituent_config") |
---|
| 662 | { |
---|
[561] | 663 | cmt.m_action = action_build_constituent_config; |
---|
| 664 | bool need_name (true); |
---|
| 665 | while (argc > 0) |
---|
[547] | 666 | { |
---|
[561] | 667 | cmt_string arg(argv[0]); |
---|
| 668 | if (arg.substr (0, 5) == "-out=") |
---|
| 669 | { |
---|
| 670 | fill_one_argument (); |
---|
| 671 | } |
---|
| 672 | else if (need_name && arg != "") |
---|
| 673 | { |
---|
| 674 | need_name = false; |
---|
| 675 | fill_one_argument (); |
---|
| 676 | } |
---|
| 677 | else |
---|
| 678 | { |
---|
| 679 | help_action = action_help; |
---|
| 680 | CmtError::set (CmtError::syntax_error, arg + ": wrong argument"); |
---|
| 681 | break; |
---|
| 682 | } |
---|
[547] | 683 | } |
---|
[561] | 684 | if (need_name) |
---|
[547] | 685 | { |
---|
| 686 | help_action = action_help; |
---|
[561] | 687 | if (!CmtError::has_pending_error ()) |
---|
| 688 | CmtError::set (CmtError::syntax_error, "argument(s) missing"); |
---|
[547] | 689 | } |
---|
| 690 | } |
---|
[2] | 691 | else if (arg == "constituents_makefile") |
---|
| 692 | { |
---|
| 693 | cmt.m_action = action_build_constituents_makefile; |
---|
[561] | 694 | while (argc > 0) |
---|
| 695 | { |
---|
| 696 | cmt_string arg(argv[0]); |
---|
| 697 | if (arg.substr (0, 5) == "-out=") |
---|
| 698 | { |
---|
| 699 | fill_one_argument (); |
---|
| 700 | } |
---|
| 701 | else |
---|
| 702 | { |
---|
| 703 | help_action = action_help; |
---|
| 704 | CmtError::set (CmtError::syntax_error, arg + ": wrong argument"); |
---|
| 705 | break; |
---|
| 706 | } |
---|
| 707 | } |
---|
[2] | 708 | } |
---|
[547] | 709 | else if (arg == "constituents_config") |
---|
| 710 | { |
---|
| 711 | cmt.m_action = action_build_constituents_config; |
---|
[561] | 712 | while (argc > 0) |
---|
| 713 | { |
---|
| 714 | cmt_string arg(argv[0]); |
---|
| 715 | if (arg.substr (0, 5) == "-out=" || |
---|
| 716 | arg == "-with_cmt" || |
---|
| 717 | arg == "-without_cmt") |
---|
| 718 | { |
---|
| 719 | fill_one_argument (); |
---|
| 720 | } |
---|
| 721 | else |
---|
| 722 | { |
---|
| 723 | help_action = action_help; |
---|
| 724 | CmtError::set (CmtError::syntax_error, arg + ": wrong argument"); |
---|
| 725 | break; |
---|
| 726 | } |
---|
| 727 | } |
---|
[547] | 728 | } |
---|
[588] | 729 | else if (arg == "broadcast_config") |
---|
| 730 | { |
---|
| 731 | cmt.m_action = action_build_broadcast_config; |
---|
| 732 | |
---|
| 733 | if (cmt.m_scope_filtering_mode == default_filtering_mode) |
---|
| 734 | { |
---|
| 735 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 736 | } |
---|
| 737 | |
---|
| 738 | while (argc > 0) |
---|
| 739 | { |
---|
| 740 | cmt_string arg(argv[0]); |
---|
| 741 | if (arg.substr (0, 5) == "-out=") |
---|
| 742 | { |
---|
| 743 | fill_one_argument (); |
---|
| 744 | } |
---|
| 745 | else |
---|
| 746 | { |
---|
| 747 | help_action = action_help; |
---|
| 748 | CmtError::set (CmtError::syntax_error, arg + ": wrong argument"); |
---|
| 749 | break; |
---|
| 750 | } |
---|
| 751 | } |
---|
| 752 | } |
---|
[2] | 753 | else if (arg == "dependencies") |
---|
| 754 | { |
---|
| 755 | if (argc > 0) |
---|
| 756 | { |
---|
[588] | 757 | // fill_arguments (); |
---|
| 758 | while (argc > 0) |
---|
| 759 | { |
---|
| 760 | cmt_string arg(argv[0]); |
---|
| 761 | if (arg.substr (0, 3) == "-f=") |
---|
| 762 | { |
---|
| 763 | shift (); |
---|
| 764 | extra_file = arg.substr (3); |
---|
| 765 | } |
---|
| 766 | else if (arg.substr (0, 3) == "-e=") |
---|
| 767 | { |
---|
| 768 | shift (); |
---|
| 769 | extra_line = arg.substr (3); |
---|
| 770 | } |
---|
| 771 | else if (arg == "-with_cmt") |
---|
| 772 | { |
---|
| 773 | shift (); |
---|
| 774 | cmt.m_use_cmt = true; |
---|
| 775 | } |
---|
| 776 | else if (arg == "-without_cmt") |
---|
| 777 | { |
---|
| 778 | shift (); |
---|
| 779 | cmt.m_use_cmt = false; |
---|
| 780 | } |
---|
| 781 | else |
---|
| 782 | { |
---|
| 783 | fill_one_argument (); |
---|
| 784 | } |
---|
| 785 | } |
---|
[2] | 786 | cmt.m_action = action_build_dependencies; |
---|
| 787 | } |
---|
| 788 | else |
---|
| 789 | { |
---|
[588] | 790 | //CmtMessage::error ("syntax: arguments missing"); |
---|
[459] | 791 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing " << endl; |
---|
[588] | 792 | CmtError::set (CmtError::syntax_error, "arguments missing"); |
---|
[2] | 793 | help_action = action_help; |
---|
| 794 | cmt.m_action = action_build_dependencies; |
---|
| 795 | } |
---|
| 796 | } |
---|
| 797 | else if (arg == "library_links") |
---|
| 798 | { |
---|
| 799 | cmt.m_action = action_build_library_links; |
---|
| 800 | } |
---|
| 801 | else if (arg == "make_setup") |
---|
| 802 | { |
---|
| 803 | cmt.m_action = action_build_make_setup; |
---|
| 804 | } |
---|
| 805 | else if (arg == "msdev") |
---|
| 806 | { |
---|
| 807 | if (argc > 0) |
---|
| 808 | { |
---|
| 809 | fill_one_argument_filtered (); |
---|
| 810 | } |
---|
| 811 | |
---|
| 812 | cmt.m_action = action_build_msdev; |
---|
| 813 | } |
---|
| 814 | else if (arg == "CMT_pacman") |
---|
| 815 | { |
---|
| 816 | cmt.m_action = action_build_CMT_pacman; |
---|
| 817 | } |
---|
| 818 | else if (arg == "vsnet") |
---|
| 819 | { |
---|
| 820 | if (argc > 0) |
---|
| 821 | { |
---|
| 822 | fill_one_argument_filtered (); |
---|
| 823 | } |
---|
| 824 | |
---|
| 825 | cmt.m_action = action_build_vsnet; |
---|
| 826 | } |
---|
| 827 | else if (arg == "os9_makefile") |
---|
| 828 | { |
---|
| 829 | if (argc > 0) |
---|
| 830 | { |
---|
| 831 | fill_one_argument (); |
---|
| 832 | cmt.m_action = action_build_os9_makefile; |
---|
| 833 | } |
---|
| 834 | else |
---|
| 835 | { |
---|
[459] | 836 | CmtMessage::error ("syntax: arguments missing"); |
---|
| 837 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing " << endl; |
---|
[2] | 838 | help_action = action_help; |
---|
| 839 | cmt.m_action = action_build_os9_makefile; |
---|
| 840 | } |
---|
| 841 | } |
---|
| 842 | else if (arg == "prototype") |
---|
| 843 | { |
---|
| 844 | if (argc > 0) |
---|
| 845 | { |
---|
| 846 | fill_one_argument (); |
---|
| 847 | cmt.m_action = action_build_prototype; |
---|
| 848 | } |
---|
| 849 | else |
---|
| 850 | { |
---|
[459] | 851 | CmtMessage::error ("syntax: arguments missing"); |
---|
| 852 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl; |
---|
[2] | 853 | help_action = action_help; |
---|
| 854 | cmt.m_action = action_build_prototype; |
---|
| 855 | } |
---|
| 856 | } |
---|
| 857 | else if (arg == "readme") |
---|
| 858 | { |
---|
| 859 | cmt.m_action = action_build_readme; |
---|
| 860 | |
---|
| 861 | fill_arguments (); |
---|
| 862 | } |
---|
| 863 | else if (arg == "tag_makefile") |
---|
| 864 | { |
---|
| 865 | cmt.m_action = action_build_tag_makefile; |
---|
| 866 | } |
---|
| 867 | else if (arg == "temporary_name") |
---|
| 868 | { |
---|
| 869 | cmt.m_action = action_build_temporary_name; |
---|
| 870 | } |
---|
| 871 | else if (arg == "triggers") |
---|
| 872 | { |
---|
| 873 | if (argc > 0) |
---|
| 874 | { |
---|
| 875 | fill_one_argument (); |
---|
| 876 | cmt.m_action = action_build_triggers; |
---|
| 877 | } |
---|
| 878 | else |
---|
| 879 | { |
---|
[459] | 880 | CmtMessage::error ("syntax: arguments missing"); |
---|
| 881 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl; |
---|
[2] | 882 | help_action = action_help; |
---|
| 883 | cmt.m_action = action_build_triggers; |
---|
| 884 | } |
---|
| 885 | } |
---|
| 886 | else if (arg == "windefs") |
---|
| 887 | { |
---|
| 888 | if (argc > 0) |
---|
| 889 | { |
---|
[466] | 890 | // fill_one_argument (); |
---|
| 891 | fill_arguments (); |
---|
[2] | 892 | cmt.m_action = action_build_windefs; |
---|
| 893 | } |
---|
| 894 | else |
---|
| 895 | { |
---|
[459] | 896 | CmtMessage::error ("syntax: arguments missing"); |
---|
| 897 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : arguments missing" << endl; |
---|
[2] | 898 | help_action = action_help; |
---|
| 899 | cmt.m_action = action_build_windefs; |
---|
| 900 | } |
---|
| 901 | } |
---|
| 902 | else |
---|
| 903 | { |
---|
[561] | 904 | CmtError::set (CmtError::syntax_error, "wrong argument: " + arg); |
---|
| 905 | //CmtMessage::error ("syntax: wrong build argument: " + arg); |
---|
[459] | 906 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : wrong build argument" << endl; |
---|
[2] | 907 | help_action = action_help; |
---|
| 908 | cmt.m_action = action_build; |
---|
| 909 | } |
---|
| 910 | } |
---|
| 911 | else |
---|
| 912 | { |
---|
[561] | 913 | cmt.m_action = action_build; |
---|
| 914 | if (help_action != action_help) |
---|
| 915 | { |
---|
| 916 | help_action = action_help; |
---|
| 917 | CmtError::set (CmtError::syntax_error, "argument(s) missing"); |
---|
| 918 | //CmtMessage::error ("syntax: don't know what to build"); |
---|
[459] | 919 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to build" << endl; |
---|
[561] | 920 | } |
---|
[2] | 921 | } |
---|
| 922 | } |
---|
| 923 | |
---|
| 924 | void ArgParser::do_check () |
---|
| 925 | { |
---|
| 926 | if (argc > 0) |
---|
| 927 | { |
---|
| 928 | arg = argv[0]; |
---|
| 929 | |
---|
| 930 | shift (); |
---|
| 931 | |
---|
| 932 | if (arg == "configuration") |
---|
| 933 | { |
---|
| 934 | cmt.m_action = action_check_configuration; |
---|
[151] | 935 | //cmt.m_warnings = true; |
---|
[2] | 936 | } |
---|
| 937 | else if (arg == "files") |
---|
| 938 | { |
---|
| 939 | if (argc > 0) |
---|
| 940 | { |
---|
| 941 | fill_one_argument (); |
---|
| 942 | if (argc > 0) |
---|
| 943 | { |
---|
| 944 | fill_one_argument (); |
---|
| 945 | cmt.m_action = action_check_files; |
---|
| 946 | } |
---|
| 947 | else |
---|
| 948 | { |
---|
[459] | 949 | CmtMessage::error ("syntax: reference file name missing"); |
---|
| 950 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : reference file name missing" << endl; |
---|
[2] | 951 | help_action = action_help; |
---|
| 952 | cmt.m_action = action_check_files; |
---|
| 953 | } |
---|
| 954 | } |
---|
| 955 | else |
---|
| 956 | { |
---|
[459] | 957 | CmtMessage::error ("syntax: file name missing"); |
---|
| 958 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : file name missing" << endl; |
---|
[2] | 959 | help_action = action_help; |
---|
| 960 | cmt.m_action = action_check_files; |
---|
| 961 | } |
---|
| 962 | } |
---|
| 963 | else if (arg == "version") |
---|
| 964 | { |
---|
| 965 | if (argc > 0) |
---|
| 966 | { |
---|
| 967 | fill_one_argument (); |
---|
| 968 | cmt.m_action = action_check_version; |
---|
| 969 | } |
---|
| 970 | else |
---|
| 971 | { |
---|
[459] | 972 | CmtMessage::error ("syntax: package name missing"); |
---|
| 973 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : package name missing" << endl; |
---|
[2] | 974 | help_action = action_help; |
---|
| 975 | cmt.m_action = action_check_version; |
---|
| 976 | } |
---|
| 977 | } |
---|
| 978 | else |
---|
| 979 | { |
---|
[459] | 980 | CmtMessage::error ("syntax: bad check option"); |
---|
| 981 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad check option" << endl; |
---|
[2] | 982 | help_action = action_help; |
---|
| 983 | cmt.m_action = action_check; |
---|
| 984 | } |
---|
| 985 | } |
---|
| 986 | else |
---|
| 987 | { |
---|
[459] | 988 | CmtMessage::error ("syntax: don't know what to check"); |
---|
| 989 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to check" << endl; |
---|
[2] | 990 | help_action = action_help; |
---|
| 991 | cmt.m_action = action_check; |
---|
| 992 | } |
---|
| 993 | } |
---|
| 994 | |
---|
| 995 | void ArgParser::do_check_files () |
---|
| 996 | { |
---|
| 997 | if (argc > 0) |
---|
| 998 | { |
---|
| 999 | fill_one_argument (); |
---|
| 1000 | if (argc > 0) |
---|
| 1001 | { |
---|
| 1002 | fill_one_argument (); |
---|
| 1003 | cmt.m_action = action_check_files; |
---|
| 1004 | } |
---|
| 1005 | else |
---|
| 1006 | { |
---|
[459] | 1007 | CmtMessage::error ("syntax: reference file name missing"); |
---|
[2] | 1008 | help_action = action_help; |
---|
| 1009 | cmt.m_action = action_check_files; |
---|
| 1010 | } |
---|
| 1011 | } |
---|
| 1012 | else |
---|
| 1013 | { |
---|
[459] | 1014 | CmtMessage::error ("syntax: file name missing"); |
---|
[2] | 1015 | help_action = action_help; |
---|
| 1016 | cmt.m_action = action_check_files; |
---|
| 1017 | } |
---|
| 1018 | } |
---|
| 1019 | |
---|
| 1020 | void ArgParser::do_checkout () |
---|
| 1021 | { |
---|
| 1022 | if (argc > 0) |
---|
| 1023 | { |
---|
| 1024 | fill_arguments (); |
---|
| 1025 | cmt.m_action = action_checkout; |
---|
| 1026 | } |
---|
| 1027 | else |
---|
| 1028 | { |
---|
[496] | 1029 | CmtError::set (CmtError::syntax_error, "checkout argument(s) missing"); |
---|
| 1030 | // CmtMessage::error ("syntax: checkout arguments missing"); |
---|
[459] | 1031 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : checkout arguments missing" << endl; |
---|
[2] | 1032 | help_action = action_help; |
---|
| 1033 | cmt.m_action = action_checkout; |
---|
| 1034 | } |
---|
| 1035 | } |
---|
| 1036 | |
---|
| 1037 | void ArgParser::do_cleanup () |
---|
| 1038 | { |
---|
| 1039 | cmt.m_action = action_cleanup; |
---|
| 1040 | } |
---|
| 1041 | |
---|
| 1042 | void ArgParser::do_config () |
---|
| 1043 | { |
---|
| 1044 | cmt.m_action = action_config; |
---|
| 1045 | } |
---|
| 1046 | |
---|
| 1047 | void ArgParser::do_create () |
---|
| 1048 | { |
---|
[599] | 1049 | if (argc >= 2) |
---|
| 1050 | //if (argc > 0) |
---|
[2] | 1051 | { |
---|
| 1052 | fill_arguments (); |
---|
| 1053 | cmt.m_action = action_create; |
---|
| 1054 | } |
---|
| 1055 | else |
---|
| 1056 | { |
---|
[599] | 1057 | CmtError::set (CmtError::syntax_error, "arguments missing"); |
---|
| 1058 | //CmtMessage::error ("syntax: create arguments missing"); |
---|
[2] | 1059 | help_action = action_help; |
---|
| 1060 | cmt.m_action = action_create; |
---|
| 1061 | } |
---|
| 1062 | } |
---|
| 1063 | |
---|
| 1064 | void ArgParser::do_create_project () |
---|
| 1065 | { |
---|
| 1066 | if (argc > 0) |
---|
| 1067 | { |
---|
| 1068 | fill_arguments (); |
---|
| 1069 | cmt.m_action = action_create_project; |
---|
| 1070 | } |
---|
| 1071 | else |
---|
| 1072 | { |
---|
[459] | 1073 | CmtMessage::error ("syntax: create_project arguments missing"); |
---|
| 1074 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : create_project arguments missing" << endl; |
---|
[2] | 1075 | help_action = action_help; |
---|
| 1076 | cmt.m_action = action_create_project; |
---|
| 1077 | } |
---|
| 1078 | } |
---|
| 1079 | |
---|
| 1080 | void ArgParser::do_cvsbranches () |
---|
| 1081 | { |
---|
| 1082 | if (argc > 0) |
---|
| 1083 | { |
---|
| 1084 | fill_one_argument (); |
---|
| 1085 | cmt.m_action = action_cvsbranches; |
---|
| 1086 | } |
---|
| 1087 | else |
---|
| 1088 | { |
---|
[459] | 1089 | CmtMessage::error ("syntax: cvsbranches arguments missing"); |
---|
| 1090 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : cvsbranches arguments missing" << endl; |
---|
[2] | 1091 | help_action = action_help; |
---|
| 1092 | cmt.m_action = action_cvsbranches; |
---|
| 1093 | } |
---|
| 1094 | } |
---|
| 1095 | |
---|
| 1096 | void ArgParser::do_cvssubpackages () |
---|
| 1097 | { |
---|
[37] | 1098 | if (argc > 0) |
---|
[2] | 1099 | { |
---|
| 1100 | fill_one_argument (); |
---|
| 1101 | } |
---|
[42] | 1102 | |
---|
| 1103 | cmt.m_action = action_cvssubpackages; |
---|
| 1104 | } |
---|
| 1105 | |
---|
| 1106 | void ArgParser::do_cvssubprojects () |
---|
| 1107 | { |
---|
| 1108 | if (argc > 0) |
---|
[2] | 1109 | { |
---|
[42] | 1110 | fill_one_argument (); |
---|
[2] | 1111 | } |
---|
[42] | 1112 | |
---|
| 1113 | cmt.m_action = action_cvssubprojects; |
---|
[2] | 1114 | } |
---|
| 1115 | |
---|
| 1116 | void ArgParser::do_cvstags () |
---|
| 1117 | { |
---|
[37] | 1118 | if (argc > 0) |
---|
[2] | 1119 | { |
---|
| 1120 | fill_arguments (); |
---|
| 1121 | cmt.m_action = action_cvstags; |
---|
| 1122 | } |
---|
| 1123 | else |
---|
| 1124 | { |
---|
[459] | 1125 | CmtMessage::error ("syntax: package name missing"); |
---|
[2] | 1126 | help_action = action_help; |
---|
| 1127 | cmt.m_action = action_cvstags; |
---|
| 1128 | } |
---|
| 1129 | } |
---|
| 1130 | |
---|
| 1131 | void ArgParser::do_do () |
---|
| 1132 | { |
---|
| 1133 | if (argc > 0) |
---|
| 1134 | { |
---|
| 1135 | fill_arguments (); |
---|
| 1136 | |
---|
| 1137 | { |
---|
| 1138 | cmt_string tag_name = "target_"; |
---|
| 1139 | tag_name += arguments[0]; |
---|
| 1140 | |
---|
| 1141 | Tag* tag; |
---|
| 1142 | tag = Tag::add (tag_name, PriorityUserTag, "action", 0); |
---|
[568] | 1143 | tag->mark ("action"); |
---|
[2] | 1144 | } |
---|
| 1145 | |
---|
| 1146 | cmt.m_action = action_do; |
---|
| 1147 | } |
---|
| 1148 | else |
---|
| 1149 | { |
---|
[459] | 1150 | CmtMessage::error ("syntax: action not specified"); |
---|
| 1151 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : action not specified" << endl; |
---|
[2] | 1152 | help_action = action_help; |
---|
| 1153 | cmt.m_action = action_do; |
---|
| 1154 | } |
---|
| 1155 | } |
---|
| 1156 | |
---|
| 1157 | void ArgParser::do_expand () |
---|
| 1158 | { |
---|
| 1159 | if (argc > 0) |
---|
| 1160 | { |
---|
| 1161 | arg = argv[0]; |
---|
| 1162 | |
---|
| 1163 | shift (); |
---|
| 1164 | if (arg == "model") |
---|
| 1165 | { |
---|
| 1166 | if (argc > 0) |
---|
| 1167 | { |
---|
| 1168 | fill_arguments (); |
---|
| 1169 | cmt.m_action = action_expand_model; |
---|
| 1170 | } |
---|
| 1171 | else |
---|
| 1172 | { |
---|
[459] | 1173 | CmtMessage::error ("syntax: model not specified"); |
---|
| 1174 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : model not specified" << endl; |
---|
[2] | 1175 | help_action = action_help; |
---|
| 1176 | cmt.m_action = action_expand_model; |
---|
| 1177 | } |
---|
| 1178 | } |
---|
| 1179 | else |
---|
| 1180 | { |
---|
[459] | 1181 | CmtMessage::error ("syntax: bad expand option"); |
---|
| 1182 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad expand option" << endl; |
---|
[2] | 1183 | help_action = action_help; |
---|
| 1184 | cmt.m_action = action_expand_model; |
---|
| 1185 | } |
---|
| 1186 | } |
---|
| 1187 | else |
---|
| 1188 | { |
---|
[459] | 1189 | CmtMessage::error ("syntax: don't know what to expand"); |
---|
| 1190 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to expand" << endl; |
---|
[2] | 1191 | help_action = action_help; |
---|
| 1192 | cmt.m_action = action_expand_model; |
---|
| 1193 | } |
---|
| 1194 | } |
---|
| 1195 | |
---|
| 1196 | void ArgParser::do_filter () |
---|
| 1197 | { |
---|
[3] | 1198 | if (argc > 0) |
---|
| 1199 | { |
---|
| 1200 | fill_arguments (); |
---|
| 1201 | cmt.m_action = action_filter; |
---|
| 1202 | } |
---|
| 1203 | else |
---|
| 1204 | { |
---|
[459] | 1205 | CmtMessage::error ("syntax: file to filter not specified"); |
---|
| 1206 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : file to filter not specified" << endl; |
---|
[3] | 1207 | help_action = action_help; |
---|
| 1208 | cmt.m_action = action_filter; |
---|
| 1209 | } |
---|
[2] | 1210 | } |
---|
| 1211 | |
---|
| 1212 | void ArgParser::do_help () |
---|
| 1213 | { |
---|
| 1214 | help_action = action_help; |
---|
| 1215 | } |
---|
| 1216 | |
---|
| 1217 | void ArgParser::do_lock () |
---|
| 1218 | { |
---|
| 1219 | if (argc > 0) |
---|
| 1220 | { |
---|
| 1221 | cmt.m_current_package = fill_one_argument (); |
---|
| 1222 | cmt.m_current_version.erase (0); |
---|
| 1223 | cmt.m_current_path.erase (0); |
---|
| 1224 | |
---|
| 1225 | if (argc > 0) |
---|
| 1226 | { |
---|
| 1227 | cmt.m_current_version = fill_one_argument (); |
---|
| 1228 | cmt.m_action = action_lock; |
---|
| 1229 | |
---|
| 1230 | if (argc > 0) |
---|
| 1231 | { |
---|
| 1232 | cmt.m_current_path = fill_one_argument_filtered (); |
---|
| 1233 | } |
---|
| 1234 | |
---|
| 1235 | cmt.m_current_access = UserMode; |
---|
| 1236 | (Use::current()).set (cmt.m_current_package, |
---|
| 1237 | cmt.m_current_version, |
---|
| 1238 | cmt.m_current_path); |
---|
| 1239 | |
---|
| 1240 | } |
---|
| 1241 | else |
---|
| 1242 | { |
---|
[459] | 1243 | CmtMessage::error ("syntax: version missing"); |
---|
| 1244 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : version missing" << endl; |
---|
[2] | 1245 | help_action = action_help; |
---|
| 1246 | cmt.m_action = action_lock; |
---|
| 1247 | } |
---|
| 1248 | } |
---|
| 1249 | else |
---|
| 1250 | { |
---|
| 1251 | cmt.m_action = action_lock; |
---|
| 1252 | } |
---|
| 1253 | } |
---|
| 1254 | |
---|
[181] | 1255 | |
---|
| 1256 | void ArgParser::do_relocate () |
---|
| 1257 | { |
---|
| 1258 | cmt.m_action = action_relocate; |
---|
| 1259 | } |
---|
| 1260 | |
---|
| 1261 | |
---|
[2] | 1262 | void ArgParser::do_remove () |
---|
| 1263 | { |
---|
| 1264 | if (argc > 0) |
---|
| 1265 | { |
---|
| 1266 | arg = argv[0]; |
---|
| 1267 | |
---|
| 1268 | if (arg == "library_links") |
---|
| 1269 | { |
---|
| 1270 | shift (); |
---|
| 1271 | cmt.m_action = action_remove_library_links; |
---|
| 1272 | } |
---|
| 1273 | else |
---|
| 1274 | { |
---|
| 1275 | cmt.m_current_package = fill_one_argument (); |
---|
| 1276 | cmt.m_current_version.erase (0); |
---|
| 1277 | cmt.m_current_path.erase (0); |
---|
| 1278 | |
---|
| 1279 | if (argc > 0) |
---|
| 1280 | { |
---|
| 1281 | cmt.m_current_version = fill_one_argument (); |
---|
| 1282 | |
---|
| 1283 | if (argc > 0) |
---|
| 1284 | { |
---|
| 1285 | cmt.m_current_path = fill_one_argument_filtered (); |
---|
| 1286 | } |
---|
| 1287 | |
---|
| 1288 | cmt.m_action = action_remove; |
---|
| 1289 | } |
---|
| 1290 | else |
---|
| 1291 | { |
---|
[459] | 1292 | CmtMessage::error ("syntax: version missing"); |
---|
[2] | 1293 | help_action = action_help; |
---|
| 1294 | cmt.m_action = action_remove; |
---|
| 1295 | } |
---|
| 1296 | } |
---|
| 1297 | } |
---|
| 1298 | else |
---|
| 1299 | { |
---|
[459] | 1300 | CmtMessage::error ("syntax: don't know what to remove"); |
---|
| 1301 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to remove" << endl; |
---|
[2] | 1302 | help_action = action_help; |
---|
| 1303 | cmt.m_action = action_remove; |
---|
| 1304 | } |
---|
| 1305 | } |
---|
| 1306 | |
---|
| 1307 | void ArgParser::do_run () |
---|
| 1308 | { |
---|
| 1309 | if (argc > 0) |
---|
| 1310 | { |
---|
| 1311 | fill_arguments (); |
---|
| 1312 | cmt.m_action = action_run; |
---|
| 1313 | } |
---|
| 1314 | else |
---|
| 1315 | { |
---|
[459] | 1316 | CmtMessage::error ("syntax: run arguments missing"); |
---|
| 1317 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : run arguments missing" << endl; |
---|
[2] | 1318 | help_action = action_help; |
---|
| 1319 | cmt.m_action = action_run; |
---|
| 1320 | } |
---|
| 1321 | } |
---|
| 1322 | |
---|
| 1323 | void ArgParser::do_run_sequence () |
---|
| 1324 | { |
---|
| 1325 | if (argc > 0) |
---|
| 1326 | { |
---|
| 1327 | fill_one_argument (); |
---|
| 1328 | cmt.m_action = action_run_sequence; |
---|
| 1329 | } |
---|
| 1330 | else |
---|
| 1331 | { |
---|
[459] | 1332 | CmtMessage::error ("syntax: run_sequence arguments missing"); |
---|
| 1333 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : run_sequence arguments missing" << endl; |
---|
[2] | 1334 | help_action = action_help; |
---|
| 1335 | cmt.m_action = action_run_sequence; |
---|
| 1336 | } |
---|
| 1337 | } |
---|
| 1338 | |
---|
| 1339 | void ArgParser::do_set () |
---|
| 1340 | { |
---|
| 1341 | if (argc > 0) |
---|
| 1342 | { |
---|
| 1343 | arg = argv[0]; |
---|
| 1344 | |
---|
| 1345 | shift (); |
---|
| 1346 | |
---|
| 1347 | if (arg == "version") |
---|
| 1348 | { |
---|
| 1349 | fill_arguments (); |
---|
| 1350 | cmt.m_action = action_set_version; |
---|
| 1351 | } |
---|
| 1352 | else if (arg == "versions") |
---|
| 1353 | { |
---|
| 1354 | fill_arguments (); |
---|
| 1355 | |
---|
| 1356 | cmt.m_action = action_set_versions; |
---|
| 1357 | |
---|
| 1358 | if (cmt.m_scope_filtering_mode == default_filtering_mode) |
---|
| 1359 | { |
---|
| 1360 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 1361 | } |
---|
| 1362 | } |
---|
| 1363 | else |
---|
| 1364 | { |
---|
[459] | 1365 | CmtMessage::error ("syntax: bad set argument"); |
---|
| 1366 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad set argument" << endl; |
---|
[2] | 1367 | help_action = action_help; |
---|
| 1368 | //cmt.m_action = action_set; |
---|
| 1369 | } |
---|
| 1370 | } |
---|
| 1371 | else |
---|
| 1372 | { |
---|
[459] | 1373 | CmtMessage::error ("syntax: don't know what to set"); |
---|
| 1374 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to set" << endl; |
---|
[2] | 1375 | help_action = action_help; |
---|
| 1376 | //cmt.m_action = action_set; |
---|
| 1377 | } |
---|
| 1378 | } |
---|
| 1379 | |
---|
| 1380 | void ArgParser::do_setup () |
---|
| 1381 | { |
---|
| 1382 | cmt.m_action = action_setup; |
---|
[151] | 1383 | //cmt.m_warnings = true; |
---|
[2] | 1384 | } |
---|
| 1385 | |
---|
| 1386 | void ArgParser::do_show () |
---|
| 1387 | { |
---|
| 1388 | if (argc > 0) |
---|
| 1389 | { |
---|
| 1390 | arg = argv[0]; |
---|
| 1391 | |
---|
| 1392 | //cerr << "Running show arg=" << arg << endl; |
---|
| 1393 | |
---|
| 1394 | shift (); |
---|
| 1395 | |
---|
| 1396 | if (arg == "action") |
---|
| 1397 | { |
---|
| 1398 | if (argc > 0) |
---|
| 1399 | { |
---|
| 1400 | cmt.m_current_target = fill_one_argument (); |
---|
| 1401 | cmt.m_action = action_show_action; |
---|
| 1402 | } |
---|
| 1403 | else |
---|
| 1404 | { |
---|
[459] | 1405 | CmtMessage::error ("syntax: action name missing"); |
---|
| 1406 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : action name missing" << endl; |
---|
[2] | 1407 | help_action = action_help; |
---|
| 1408 | cmt.m_action = action_show_action; |
---|
| 1409 | } |
---|
| 1410 | } |
---|
| 1411 | else if (arg == "action_names") |
---|
| 1412 | { |
---|
| 1413 | if (argc > 0) |
---|
| 1414 | { |
---|
| 1415 | fill_one_argument (); |
---|
| 1416 | } |
---|
| 1417 | |
---|
| 1418 | cmt.m_action = action_show_action_names; |
---|
| 1419 | } |
---|
| 1420 | else if (arg == "action_value") |
---|
| 1421 | { |
---|
| 1422 | cmt.m_quiet = true; |
---|
| 1423 | if (argc > 0) |
---|
| 1424 | { |
---|
| 1425 | cmt.m_current_target = fill_one_argument (); |
---|
| 1426 | cmt.m_action = action_show_action_value; |
---|
| 1427 | } |
---|
| 1428 | else |
---|
| 1429 | { |
---|
[459] | 1430 | CmtMessage::error ("syntax: action name missing"); |
---|
[2] | 1431 | help_action = action_help; |
---|
| 1432 | cmt.m_action = action_show_action_value; |
---|
| 1433 | } |
---|
| 1434 | } |
---|
| 1435 | else if (arg == "actions") |
---|
| 1436 | { |
---|
| 1437 | if (argc > 0) |
---|
| 1438 | { |
---|
| 1439 | fill_one_argument (); |
---|
| 1440 | } |
---|
| 1441 | |
---|
| 1442 | cmt.m_action = action_show_actions; |
---|
| 1443 | } |
---|
[612] | 1444 | else if (arg == "alias") |
---|
| 1445 | { |
---|
| 1446 | if (argc > 0) |
---|
| 1447 | { |
---|
| 1448 | cmt.m_current_target = fill_one_argument (); |
---|
| 1449 | cmt.m_action = action_show_alias; |
---|
| 1450 | } |
---|
| 1451 | else |
---|
| 1452 | { |
---|
| 1453 | CmtError::set (CmtError::syntax_error, "alias name missing"); |
---|
| 1454 | //CmtMessage::error ("syntax: alias name missing"); |
---|
| 1455 | help_action = action_help; |
---|
| 1456 | cmt.m_action = action_show_alias; |
---|
| 1457 | } |
---|
| 1458 | } |
---|
| 1459 | else if (arg == "alias_names") |
---|
| 1460 | { |
---|
| 1461 | if (argc > 0) |
---|
| 1462 | { |
---|
| 1463 | fill_one_argument (); |
---|
| 1464 | } |
---|
| 1465 | |
---|
| 1466 | cmt.m_action = action_show_alias_names; |
---|
| 1467 | } |
---|
| 1468 | else if (arg == "alias_value") |
---|
| 1469 | { |
---|
| 1470 | cmt.m_quiet = true; |
---|
| 1471 | if (argc > 0) |
---|
| 1472 | { |
---|
| 1473 | cmt.m_current_target = fill_one_argument (); |
---|
| 1474 | cmt.m_action = action_show_alias_value; |
---|
| 1475 | } |
---|
| 1476 | else |
---|
| 1477 | { |
---|
| 1478 | CmtError::set (CmtError::syntax_error, "alias name missing"); |
---|
| 1479 | //CmtMessage::error ("syntax: alias name missing"); |
---|
| 1480 | help_action = action_help; |
---|
| 1481 | cmt.m_action = action_show_alias_value; |
---|
| 1482 | } |
---|
| 1483 | } |
---|
| 1484 | else if (arg == "aliases") |
---|
| 1485 | { |
---|
| 1486 | if (argc > 0) |
---|
| 1487 | { |
---|
| 1488 | fill_one_argument (); |
---|
| 1489 | } |
---|
| 1490 | |
---|
| 1491 | cmt.m_action = action_show_aliases; |
---|
| 1492 | } |
---|
[2] | 1493 | else if (arg == "all_tags") |
---|
| 1494 | { |
---|
| 1495 | cmt.m_action = action_show_all_tags; |
---|
| 1496 | } |
---|
| 1497 | else if (arg == "applied_patterns") |
---|
| 1498 | { |
---|
| 1499 | cmt.m_action = action_show_applied_patterns; |
---|
| 1500 | } |
---|
| 1501 | else if (arg == "author") |
---|
| 1502 | { |
---|
| 1503 | cmt.m_action = action_show_author; |
---|
| 1504 | } |
---|
| 1505 | else if (arg == "branches") |
---|
| 1506 | { |
---|
| 1507 | cmt.m_action = action_show_branches; |
---|
| 1508 | } |
---|
| 1509 | else if (arg == "clients") |
---|
| 1510 | { |
---|
| 1511 | if (argc > 0) |
---|
| 1512 | { |
---|
| 1513 | cmt.m_current_target = fill_one_argument (); |
---|
| 1514 | |
---|
| 1515 | cmt.m_action = action_show_clients; |
---|
| 1516 | |
---|
| 1517 | if (argc > 0) |
---|
| 1518 | { |
---|
| 1519 | fill_one_argument (); |
---|
| 1520 | if (argc > 0) |
---|
| 1521 | { |
---|
| 1522 | fill_one_argument (); |
---|
| 1523 | } |
---|
| 1524 | } |
---|
| 1525 | } |
---|
| 1526 | else |
---|
| 1527 | { |
---|
[459] | 1528 | CmtMessage::error ("syntax: package name missing"); |
---|
[2] | 1529 | help_action = action_help; |
---|
| 1530 | cmt.m_action = action_show_clients; |
---|
| 1531 | } |
---|
| 1532 | } |
---|
| 1533 | else if (arg == "cmtpath_patterns") |
---|
| 1534 | { |
---|
| 1535 | cmt.m_action = action_show_cmtpath_patterns; |
---|
| 1536 | } |
---|
| 1537 | else if (arg == "constituent") |
---|
| 1538 | { |
---|
| 1539 | if (argc > 0) |
---|
| 1540 | { |
---|
| 1541 | cmt.m_current_target = fill_one_argument (); |
---|
| 1542 | cmt.m_action = action_show_constituent; |
---|
| 1543 | } |
---|
| 1544 | else |
---|
| 1545 | { |
---|
[459] | 1546 | CmtMessage::error ("syntax: constituent name missing"); |
---|
| 1547 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : constituent name missing" << endl; |
---|
[2] | 1548 | help_action = action_help; |
---|
| 1549 | cmt.m_action = action_show_constituent; |
---|
| 1550 | } |
---|
| 1551 | } |
---|
| 1552 | else if (arg == "constituent_names") |
---|
| 1553 | { |
---|
| 1554 | cmt.m_action = action_show_constituent_names; |
---|
| 1555 | } |
---|
| 1556 | else if (arg == "constituents") |
---|
| 1557 | { |
---|
| 1558 | cmt.m_action = action_show_constituents; |
---|
| 1559 | } |
---|
[525] | 1560 | else if (arg == "container") |
---|
| 1561 | { |
---|
[541] | 1562 | if (argc > 0) |
---|
| 1563 | { |
---|
| 1564 | fill_arguments (); |
---|
| 1565 | } |
---|
[525] | 1566 | cmt.m_action = action_show_container; |
---|
| 1567 | } |
---|
[2] | 1568 | else if (arg == "cycles") |
---|
| 1569 | { |
---|
| 1570 | cmt.m_action = action_show_cycles; |
---|
| 1571 | } |
---|
| 1572 | else if (arg == "fragment") |
---|
| 1573 | { |
---|
| 1574 | if (argc > 0) |
---|
| 1575 | { |
---|
| 1576 | cmt.m_current_target = fill_one_argument (); |
---|
| 1577 | cmt.m_action = action_show_fragment; |
---|
| 1578 | } |
---|
| 1579 | else |
---|
| 1580 | { |
---|
[459] | 1581 | CmtMessage::error ("syntax: fragment name missing"); |
---|
| 1582 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : fragment name missing" << endl; |
---|
[2] | 1583 | help_action = action_help; |
---|
| 1584 | cmt.m_action = action_show_fragment; |
---|
| 1585 | } |
---|
| 1586 | } |
---|
| 1587 | else if (arg == "fragments") |
---|
| 1588 | { |
---|
| 1589 | cmt.m_action = action_show_fragments; |
---|
| 1590 | } |
---|
| 1591 | else if (arg == "groups") |
---|
| 1592 | { |
---|
| 1593 | cmt.m_action = action_show_groups; |
---|
| 1594 | } |
---|
| 1595 | else if (arg == "include_dirs") |
---|
| 1596 | { |
---|
| 1597 | cmt.m_action = action_show_include_dirs; |
---|
| 1598 | } |
---|
| 1599 | else if (arg == "language") |
---|
| 1600 | { |
---|
| 1601 | if (argc > 0) |
---|
| 1602 | { |
---|
| 1603 | cmt.m_current_target = fill_one_argument (); |
---|
| 1604 | cmt.m_action = action_show_language; |
---|
| 1605 | } |
---|
| 1606 | else |
---|
| 1607 | { |
---|
[459] | 1608 | CmtMessage::error ("syntax: language name missing"); |
---|
| 1609 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : language name missing" << endl; |
---|
[2] | 1610 | help_action = action_help; |
---|
| 1611 | cmt.m_action = action_show_language; |
---|
| 1612 | } |
---|
| 1613 | } |
---|
| 1614 | else if (arg == "languages") |
---|
| 1615 | { |
---|
| 1616 | cmt.m_action = action_show_languages; |
---|
| 1617 | } |
---|
| 1618 | else if (arg == "macro") |
---|
| 1619 | { |
---|
| 1620 | if (argc > 0) |
---|
| 1621 | { |
---|
| 1622 | cmt.m_current_target = fill_one_argument (); |
---|
| 1623 | cmt.m_action = action_show_macro; |
---|
| 1624 | } |
---|
| 1625 | else |
---|
| 1626 | { |
---|
[459] | 1627 | CmtMessage::error ("syntax: macro name missing"); |
---|
| 1628 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : macro name missing" << endl; |
---|
[2] | 1629 | help_action = action_help; |
---|
| 1630 | cmt.m_action = action_show_macro; |
---|
| 1631 | } |
---|
| 1632 | } |
---|
| 1633 | else if (arg == "macro_names") |
---|
| 1634 | { |
---|
| 1635 | if (argc > 0) |
---|
| 1636 | { |
---|
| 1637 | fill_one_argument (); |
---|
| 1638 | } |
---|
| 1639 | |
---|
| 1640 | cmt.m_action = action_show_macro_names; |
---|
| 1641 | } |
---|
| 1642 | else if (arg == "macro_value") |
---|
| 1643 | { |
---|
| 1644 | cmt.m_quiet = true; |
---|
| 1645 | if (argc > 0) |
---|
| 1646 | { |
---|
| 1647 | cmt.m_current_target = fill_one_argument (); |
---|
| 1648 | cmt.m_action = action_show_macro_value; |
---|
| 1649 | } |
---|
| 1650 | else |
---|
| 1651 | { |
---|
[459] | 1652 | CmtMessage::error ("syntax: macro name missing"); |
---|
[2] | 1653 | help_action = action_help; |
---|
| 1654 | cmt.m_action = action_show_macro_value; |
---|
| 1655 | } |
---|
| 1656 | } |
---|
| 1657 | else if (arg == "macros") |
---|
| 1658 | { |
---|
| 1659 | if (argc > 0) |
---|
| 1660 | { |
---|
| 1661 | fill_one_argument (); |
---|
| 1662 | } |
---|
| 1663 | |
---|
| 1664 | cmt.m_action = action_show_macros; |
---|
| 1665 | } |
---|
| 1666 | else if (arg == "manager") |
---|
| 1667 | { |
---|
| 1668 | cmt.m_action = action_show_manager; |
---|
| 1669 | } |
---|
| 1670 | else if (arg == "packages") |
---|
| 1671 | { |
---|
| 1672 | if (argc > 0) |
---|
| 1673 | { |
---|
[528] | 1674 | fill_arguments (); |
---|
| 1675 | // cmt.m_current_target = fill_one_argument (); |
---|
[2] | 1676 | } |
---|
| 1677 | |
---|
| 1678 | cmt.m_action = action_show_packages; |
---|
| 1679 | } |
---|
| 1680 | else if (arg == "path") |
---|
| 1681 | { |
---|
[482] | 1682 | if (argc == 0) |
---|
| 1683 | { |
---|
| 1684 | cmt.m_action = action_show_path; |
---|
| 1685 | } |
---|
| 1686 | else if (argc == 1 && cmt_string (argv[0]) == "-d") |
---|
| 1687 | { |
---|
| 1688 | fill_one_argument (); |
---|
| 1689 | cmt.m_action = action_show_path; |
---|
| 1690 | } |
---|
| 1691 | else |
---|
| 1692 | { |
---|
| 1693 | cmt.m_action = action_show_path; |
---|
| 1694 | help_action = action_help; |
---|
| 1695 | } |
---|
[2] | 1696 | } |
---|
| 1697 | else if (arg == "pattern") |
---|
| 1698 | { |
---|
| 1699 | if (argc > 0) |
---|
| 1700 | { |
---|
| 1701 | cmt.m_current_target = fill_one_argument (); |
---|
| 1702 | cmt.m_action = action_show_pattern; |
---|
| 1703 | } |
---|
| 1704 | else |
---|
| 1705 | { |
---|
[459] | 1706 | CmtMessage::error ("syntax: pattern name missing"); |
---|
| 1707 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : pattern name missing" << endl; |
---|
[2] | 1708 | help_action = action_help; |
---|
| 1709 | cmt.m_action = action_show_pattern; |
---|
| 1710 | } |
---|
| 1711 | } |
---|
| 1712 | else if (arg == "pattern_names") |
---|
| 1713 | { |
---|
| 1714 | cmt.m_action = action_show_pattern_names; |
---|
| 1715 | } |
---|
| 1716 | else if (arg == "patterns") |
---|
| 1717 | { |
---|
| 1718 | cmt.m_action = action_show_patterns; |
---|
| 1719 | } |
---|
| 1720 | else if (arg == "projects") |
---|
| 1721 | { |
---|
| 1722 | cmt.m_action = action_show_projects; |
---|
| 1723 | } |
---|
[272] | 1724 | else if (arg == "project_author") |
---|
| 1725 | { |
---|
| 1726 | cmt.m_action = action_show_project_author; |
---|
| 1727 | } |
---|
| 1728 | |
---|
[2] | 1729 | else if (arg == "pwd") |
---|
| 1730 | { |
---|
| 1731 | cmt.m_action = action_show_pwd; |
---|
| 1732 | } |
---|
| 1733 | else if (arg == "setup") |
---|
| 1734 | { |
---|
| 1735 | cmt.m_action = action_show_setup; |
---|
| 1736 | |
---|
| 1737 | if (cmt.m_scope_filtering_mode == default_filtering_mode) |
---|
| 1738 | { |
---|
| 1739 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 1740 | } |
---|
| 1741 | } |
---|
| 1742 | else if (arg == "set_names") |
---|
| 1743 | { |
---|
| 1744 | if (argc > 0) |
---|
| 1745 | { |
---|
| 1746 | fill_one_argument (); |
---|
| 1747 | } |
---|
| 1748 | |
---|
| 1749 | cmt.m_action = action_show_set_names; |
---|
| 1750 | } |
---|
| 1751 | else if (arg == "set_value") |
---|
| 1752 | { |
---|
| 1753 | cmt.m_quiet = true; |
---|
| 1754 | if (argc > 0) |
---|
| 1755 | { |
---|
| 1756 | cmt.m_current_target = fill_one_argument (); |
---|
| 1757 | cmt.m_action = action_show_set_value; |
---|
| 1758 | } |
---|
| 1759 | else |
---|
| 1760 | { |
---|
[459] | 1761 | CmtMessage::error ("syntax: set name missing"); |
---|
| 1762 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : set name missing" << endl; |
---|
[2] | 1763 | help_action = action_help; |
---|
| 1764 | cmt.m_action = action_show_set_value; |
---|
| 1765 | } |
---|
| 1766 | } |
---|
| 1767 | else if (arg == "set") |
---|
| 1768 | { |
---|
| 1769 | if (argc > 0) |
---|
| 1770 | { |
---|
| 1771 | cmt.m_current_target = fill_one_argument (); |
---|
| 1772 | cmt.m_action = action_show_set; |
---|
| 1773 | } |
---|
| 1774 | else |
---|
| 1775 | { |
---|
[459] | 1776 | CmtMessage::error ("syntax: set name missing"); |
---|
[2] | 1777 | help_action = action_help; |
---|
| 1778 | cmt.m_action = action_show_set; |
---|
| 1779 | } |
---|
| 1780 | } |
---|
| 1781 | else if (arg == "sets") |
---|
| 1782 | { |
---|
| 1783 | if (argc > 0) |
---|
| 1784 | { |
---|
| 1785 | fill_one_argument (); |
---|
| 1786 | } |
---|
| 1787 | |
---|
| 1788 | cmt.m_action = action_show_sets; |
---|
| 1789 | } |
---|
| 1790 | else if (arg == "strategies") |
---|
| 1791 | { |
---|
| 1792 | cmt.m_action = action_show_strategies; |
---|
| 1793 | } |
---|
| 1794 | else if (arg == "tags") |
---|
| 1795 | { |
---|
| 1796 | cmt.m_action = action_show_tags; |
---|
| 1797 | } |
---|
| 1798 | else if (arg == "use_paths") |
---|
| 1799 | { |
---|
| 1800 | if (argc > 0) |
---|
| 1801 | { |
---|
| 1802 | while (argc > 0) |
---|
| 1803 | { |
---|
| 1804 | if (strcmp (argv[0], "-private") == 0) |
---|
| 1805 | { |
---|
| 1806 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 1807 | } |
---|
| 1808 | else if (strcmp (argv[0], "--private") == 0) |
---|
| 1809 | { |
---|
| 1810 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 1811 | } |
---|
| 1812 | else |
---|
| 1813 | { |
---|
| 1814 | cmt_string& s = arguments.add (); |
---|
| 1815 | s = argv[0]; |
---|
| 1816 | } |
---|
| 1817 | |
---|
| 1818 | shift (); |
---|
| 1819 | } |
---|
| 1820 | |
---|
| 1821 | cmt.m_action = action_show_use_paths; |
---|
| 1822 | } |
---|
| 1823 | else |
---|
| 1824 | { |
---|
[459] | 1825 | CmtMessage::error ("syntax: package name missing"); |
---|
[2] | 1826 | help_action = action_help; |
---|
| 1827 | cmt.m_action = action_show_use_paths; |
---|
| 1828 | } |
---|
| 1829 | } |
---|
| 1830 | else if ((arg == "u") || |
---|
| 1831 | (arg == "us") || |
---|
| 1832 | (arg == "use") || |
---|
| 1833 | (arg == "uses")) |
---|
| 1834 | { |
---|
| 1835 | cmt.m_action = action_show_uses; |
---|
| 1836 | |
---|
| 1837 | if (cmt.m_scope_filtering_mode == default_filtering_mode) |
---|
| 1838 | { |
---|
| 1839 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 1840 | } |
---|
| 1841 | } |
---|
| 1842 | else if (arg == "version") |
---|
| 1843 | { |
---|
| 1844 | cmt.m_action = action_show_version; |
---|
| 1845 | } |
---|
| 1846 | else if (arg == "versions") |
---|
| 1847 | { |
---|
| 1848 | if (argc > 0) |
---|
| 1849 | { |
---|
| 1850 | cmt.m_current_target = fill_one_argument (); |
---|
| 1851 | cmt.m_action = action_show_versions; |
---|
| 1852 | } |
---|
| 1853 | else |
---|
| 1854 | { |
---|
[459] | 1855 | CmtMessage::error ("syntax: package name missing"); |
---|
[2] | 1856 | help_action = action_help; |
---|
| 1857 | cmt.m_action = action_show_versions; |
---|
| 1858 | } |
---|
| 1859 | } |
---|
| 1860 | else |
---|
| 1861 | { |
---|
[459] | 1862 | CmtMessage::error ("syntax: bad show argument"); |
---|
| 1863 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : bad show argument" << endl; |
---|
[2] | 1864 | help_action = action_help; |
---|
| 1865 | cmt.m_action = action_show; |
---|
| 1866 | } |
---|
| 1867 | } |
---|
| 1868 | else |
---|
| 1869 | { |
---|
[459] | 1870 | CmtMessage::error ("syntax: don't know what to show"); |
---|
| 1871 | // if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to show" << endl; |
---|
[2] | 1872 | help_action = action_help; |
---|
| 1873 | cmt.m_action = action_show; |
---|
| 1874 | } |
---|
| 1875 | } |
---|
| 1876 | |
---|
| 1877 | void ArgParser::do_system () |
---|
| 1878 | { |
---|
| 1879 | cmt.m_action = action_system; |
---|
| 1880 | } |
---|
| 1881 | |
---|
| 1882 | void ArgParser::do_unlock () |
---|
| 1883 | { |
---|
| 1884 | if (argc > 0) |
---|
| 1885 | { |
---|
| 1886 | cmt.m_current_package = fill_one_argument (); |
---|
| 1887 | cmt.m_current_version.erase (0); |
---|
| 1888 | cmt.m_current_path.erase (0); |
---|
| 1889 | |
---|
| 1890 | if (argc > 0) |
---|
| 1891 | { |
---|
| 1892 | cmt.m_current_version = fill_one_argument (); |
---|
| 1893 | cmt.m_action = action_unlock; |
---|
| 1894 | |
---|
| 1895 | if (argc > 0) |
---|
| 1896 | { |
---|
| 1897 | cmt.m_current_path = fill_one_argument_filtered (); |
---|
| 1898 | } |
---|
| 1899 | |
---|
| 1900 | cmt.m_current_access = UserMode; |
---|
| 1901 | (Use::current()).set (cmt.m_current_package, |
---|
| 1902 | cmt.m_current_version, |
---|
| 1903 | cmt.m_current_path); |
---|
| 1904 | |
---|
| 1905 | } |
---|
| 1906 | else |
---|
| 1907 | { |
---|
[459] | 1908 | CmtMessage::error ("syntax: version missing"); |
---|
[2] | 1909 | help_action = action_help; |
---|
| 1910 | cmt.m_action = action_unlock; |
---|
| 1911 | } |
---|
| 1912 | } |
---|
| 1913 | else |
---|
| 1914 | { |
---|
| 1915 | cmt.m_action = action_unlock; |
---|
| 1916 | } |
---|
| 1917 | } |
---|
| 1918 | |
---|
| 1919 | void ArgParser::do_version () |
---|
| 1920 | { |
---|
| 1921 | cmt.m_action = action_version; |
---|
| 1922 | } |
---|
| 1923 | |
---|
| 1924 | void ArgParser::option_help () |
---|
| 1925 | { |
---|
| 1926 | help_action = action_help; |
---|
| 1927 | } |
---|
| 1928 | |
---|
| 1929 | void ArgParser::option_n () |
---|
| 1930 | { |
---|
| 1931 | cmt.m_simulation = true; |
---|
| 1932 | } |
---|
| 1933 | |
---|
[282] | 1934 | |
---|
| 1935 | void ArgParser::option_disable_warnings () |
---|
| 1936 | { |
---|
| 1937 | cmt.m_disable_warnings = true; |
---|
[652] | 1938 | // if (CmtMessage::level () <= Warning) |
---|
| 1939 | // CmtMessage::set_level (Error); |
---|
| 1940 | if (!Cmt::add_cmt_flag ("-disable_warnings")) |
---|
| 1941 | CmtError::set (CmtError::system_error, "Cannot add flag `-disable_warnings'"); |
---|
[282] | 1942 | } |
---|
| 1943 | |
---|
[2] | 1944 | void ArgParser::option_quiet () |
---|
| 1945 | { |
---|
| 1946 | cmt.m_quiet = true; |
---|
[652] | 1947 | // if (CmtMessage::level () <= Error) |
---|
| 1948 | // CmtMessage::set_level (Fatal); |
---|
| 1949 | if (!Cmt::add_cmt_flag ("-quiet")) |
---|
| 1950 | CmtError::set (CmtError::system_error, "Cannot add flag `-quiet'"); |
---|
[2] | 1951 | } |
---|
| 1952 | |
---|
[282] | 1953 | |
---|
[109] | 1954 | void ArgParser::option_warnings () |
---|
| 1955 | { |
---|
| 1956 | cmt.m_warnings = true; |
---|
[652] | 1957 | // if (CmtMessage::level () != Warning) |
---|
| 1958 | // CmtMessage::set_level (Warning); |
---|
| 1959 | if (!Cmt::add_cmt_flag ("-warnings")) |
---|
| 1960 | CmtError::set (CmtError::system_error, "Cannot add flag `-warnings'"); |
---|
[109] | 1961 | } |
---|
| 1962 | |
---|
[2] | 1963 | void ArgParser::option_csh () |
---|
| 1964 | { |
---|
| 1965 | mode = Csh; |
---|
| 1966 | } |
---|
| 1967 | |
---|
| 1968 | void ArgParser::option_sh () |
---|
| 1969 | { |
---|
| 1970 | mode = Sh; |
---|
| 1971 | } |
---|
| 1972 | |
---|
| 1973 | void ArgParser::option_bat () |
---|
| 1974 | { |
---|
| 1975 | mode = Bat; |
---|
| 1976 | } |
---|
| 1977 | |
---|
[549] | 1978 | void ArgParser::option_requirements () |
---|
| 1979 | { |
---|
| 1980 | mode = Requirements; |
---|
| 1981 | } |
---|
| 1982 | |
---|
[550] | 1983 | void ArgParser::option_xml () |
---|
| 1984 | { |
---|
| 1985 | mode = Xml; |
---|
| 1986 | } |
---|
| 1987 | |
---|
[2] | 1988 | void ArgParser::option_use () |
---|
| 1989 | { |
---|
| 1990 | if (cmt.m_action != action_create) |
---|
| 1991 | { |
---|
| 1992 | CmtSystem::cmt_string_vector words; |
---|
| 1993 | CmtSystem::split (arg, ":", words); |
---|
| 1994 | |
---|
| 1995 | cmt.m_current_access = UserMode; |
---|
| 1996 | |
---|
[649] | 1997 | cmt.m_current_package = ""; |
---|
| 1998 | cmt.m_current_version = ""; |
---|
| 1999 | cmt.m_current_path = ""; |
---|
| 2000 | |
---|
[2] | 2001 | if (words.size () > 0) cmt.m_current_package = words[0]; |
---|
| 2002 | if (words.size () > 1) cmt.m_current_version = words[1]; |
---|
| 2003 | if (words.size () > 2) cmt.m_current_path = words[2]; |
---|
| 2004 | } |
---|
| 2005 | } |
---|
| 2006 | |
---|
| 2007 | void ArgParser::option_pack () |
---|
| 2008 | { |
---|
| 2009 | if ((cmt.m_action != action_create) && (cmt.m_current_package != arg)) |
---|
| 2010 | { |
---|
| 2011 | //CmtSystem::cd (cmt.m_default_path); |
---|
| 2012 | |
---|
| 2013 | cmt.m_current_access = UserMode; |
---|
| 2014 | |
---|
| 2015 | cmt.m_current_package = arg; |
---|
[652] | 2016 | // cmt.m_current_version = ""; |
---|
[2] | 2017 | |
---|
| 2018 | } |
---|
| 2019 | } |
---|
| 2020 | |
---|
| 2021 | void ArgParser::option_version () |
---|
| 2022 | { |
---|
| 2023 | if ((cmt.m_action != action_create) && (cmt.m_current_version != arg)) |
---|
| 2024 | { |
---|
| 2025 | cmt.m_current_access = UserMode; |
---|
| 2026 | cmt.m_current_version = arg; |
---|
| 2027 | } |
---|
| 2028 | } |
---|
| 2029 | |
---|
| 2030 | void ArgParser::option_path () |
---|
| 2031 | { |
---|
| 2032 | if ((cmt.m_action != action_create) && (cmt.m_current_path != arg)) |
---|
| 2033 | { |
---|
| 2034 | cmt.m_current_access = UserMode; |
---|
| 2035 | cmt.m_current_path = arg; |
---|
| 2036 | } |
---|
| 2037 | } |
---|
| 2038 | |
---|
| 2039 | void ArgParser::option_f () |
---|
| 2040 | { |
---|
| 2041 | extra_file = arg; |
---|
| 2042 | } |
---|
| 2043 | |
---|
| 2044 | void ArgParser::option_e () |
---|
| 2045 | { |
---|
| 2046 | extra_line = arg; |
---|
| 2047 | } |
---|
| 2048 | |
---|
| 2049 | void ArgParser::option_home () |
---|
| 2050 | { |
---|
| 2051 | if (CmtSystem::test_directory (arg)) |
---|
| 2052 | { |
---|
| 2053 | cmt.m_cmt_home = arg; |
---|
| 2054 | } |
---|
| 2055 | } |
---|
| 2056 | |
---|
[659] | 2057 | void ArgParser::option_no_strip_path () |
---|
[656] | 2058 | { |
---|
[659] | 2059 | cmt.m_strip_path = false; |
---|
| 2060 | if (!Cmt::add_cmt_flag ("-no_strip_path")) |
---|
| 2061 | CmtMessage::error ("Cannot add flag `-no_strip_path'"); |
---|
[656] | 2062 | } |
---|
| 2063 | |
---|
[659] | 2064 | void ArgParser::option_strip_path () |
---|
[656] | 2065 | { |
---|
[659] | 2066 | cmt.m_strip_path = true; |
---|
| 2067 | if (!Cmt::add_cmt_flag ("-strip_path")) |
---|
| 2068 | CmtMessage::error ("Cannot add flag `-strip_path'"); |
---|
[656] | 2069 | } |
---|
| 2070 | |
---|
[2] | 2071 | void ArgParser::option_tag () |
---|
| 2072 | { |
---|
| 2073 | /* |
---|
| 2074 | Here we are going to change the complete tag set |
---|
| 2075 | */ |
---|
| 2076 | if (arg != "") |
---|
| 2077 | { |
---|
[652] | 2078 | cmt.m_tags.clear (); |
---|
| 2079 | CmtSystem::cmt_string_vector words; |
---|
| 2080 | CmtSystem::split (arg, " \t,", words); |
---|
| 2081 | for (int i = 0; i < words.size (); i++) |
---|
| 2082 | { |
---|
| 2083 | bool has (false); |
---|
| 2084 | for (int j = 0; j < cmt.m_tags.size (); j++) |
---|
| 2085 | { |
---|
| 2086 | if (cmt.m_tags[j] == words[i]) |
---|
| 2087 | { |
---|
| 2088 | has = true; |
---|
| 2089 | break; |
---|
| 2090 | } |
---|
| 2091 | } |
---|
| 2092 | if (!has) |
---|
| 2093 | cmt.m_tags.push_back (words[i]); |
---|
| 2094 | } |
---|
| 2095 | |
---|
| 2096 | if (cmt.m_tags.size () != 0) |
---|
| 2097 | { |
---|
| 2098 | cmt.m_extra_tags.clear (); |
---|
| 2099 | cmt.m_tags_add.clear (); |
---|
| 2100 | cmt.m_tags_remove.clear (); |
---|
| 2101 | } |
---|
| 2102 | |
---|
| 2103 | /* |
---|
[2] | 2104 | Tag* tag; |
---|
| 2105 | CmtSystem::cmt_string_vector words; |
---|
[3] | 2106 | |
---|
[2] | 2107 | // First reset selection of all existing tags |
---|
| 2108 | //Tag::clear_all (); |
---|
| 2109 | Tag::unmark_all (); |
---|
| 2110 | cmt.m_extra_tags = ","; |
---|
| 2111 | |
---|
| 2112 | // Then restore CMTSITE |
---|
| 2113 | Cmt::configure_version_tag (); |
---|
| 2114 | Cmt::configure_site_tag (0); |
---|
| 2115 | Cmt::configure_uname_tag (); |
---|
| 2116 | Cmt::configure_hosttype_tag (); |
---|
| 2117 | Cmt::configure_config_tag (); |
---|
| 2118 | Cmt::configure_home (0); |
---|
| 2119 | Cmt::guess_current_project (); |
---|
| 2120 | |
---|
| 2121 | CmtSystem::split (arg, " \t,", words); |
---|
| 2122 | |
---|
| 2123 | for (int i = 0; i < words.size (); i++) |
---|
| 2124 | { |
---|
| 2125 | const cmt_string& a = words[i]; |
---|
[329] | 2126 | //if (!cmt.m_quiet) cout << "parse_argument(tag_add)> current_tag=" << a << endl; |
---|
[2] | 2127 | cmt_string s = ","; |
---|
| 2128 | s += a; |
---|
| 2129 | s += ","; |
---|
| 2130 | |
---|
| 2131 | if (i == 0) |
---|
| 2132 | { |
---|
| 2133 | cmt.m_current_tag = a; |
---|
| 2134 | |
---|
[329] | 2135 | if (CmtSystem::testenv ("TAGDEBUG")) |
---|
| 2136 | cerr << "parse_argument(tag_add)> current_tag=" << cmt.m_current_tag << endl; |
---|
[2] | 2137 | } |
---|
| 2138 | |
---|
| 2139 | if (cmt.m_extra_tags.find (s) == cmt_string::npos) |
---|
| 2140 | { |
---|
| 2141 | //if (!cmt.m_quiet) cerr << " a=[" << a << "]" << endl; |
---|
| 2142 | |
---|
| 2143 | // Then restore uname if the specified tag is CMTCONFIG |
---|
| 2144 | if (a == CmtSystem::get_cmt_config ()) |
---|
| 2145 | { |
---|
| 2146 | Cmt::configure_uname_tag (); |
---|
| 2147 | } |
---|
| 2148 | |
---|
| 2149 | tag = Tag::add (a, PriorityArgument, "arguments", 0); |
---|
[568] | 2150 | tag->mark ("arguments"); |
---|
[2] | 2151 | cmt.m_extra_tags += a; |
---|
| 2152 | cmt.m_extra_tags += ","; |
---|
| 2153 | } |
---|
| 2154 | } |
---|
[329] | 2155 | // To be sure that a tag |
---|
| 2156 | Cmt::guess_current_project (); |
---|
[652] | 2157 | */ |
---|
[2] | 2158 | } |
---|
| 2159 | } |
---|
| 2160 | |
---|
| 2161 | void ArgParser::option_tag_add () |
---|
| 2162 | { |
---|
[652] | 2163 | CmtSystem::cmt_string_vector words; |
---|
| 2164 | CmtSystem::split (arg, " \t,", words); |
---|
| 2165 | for (int i = 0; i < words.size (); i++) |
---|
| 2166 | { |
---|
| 2167 | bool has (false); |
---|
| 2168 | for (int j = 0; j < cmt.m_tags_add.size (); j++) |
---|
| 2169 | { |
---|
| 2170 | if (cmt.m_tags_add[j] == words[i]) |
---|
| 2171 | { |
---|
| 2172 | has = true; |
---|
| 2173 | break; |
---|
| 2174 | } |
---|
| 2175 | } |
---|
| 2176 | if (!has) |
---|
| 2177 | { |
---|
| 2178 | cmt.m_tags_add.push_back (words[i]); |
---|
| 2179 | } |
---|
| 2180 | |
---|
| 2181 | for (int j = 0; j < cmt.m_tags_remove.size (); j++) |
---|
| 2182 | { |
---|
| 2183 | if (cmt.m_tags_remove[j] == words[i]) |
---|
| 2184 | { |
---|
| 2185 | cmt.m_tags_remove.erase(j); |
---|
| 2186 | break; |
---|
| 2187 | } |
---|
| 2188 | } |
---|
| 2189 | } |
---|
| 2190 | /* |
---|
[2] | 2191 | Tag* tag; |
---|
| 2192 | CmtSystem::cmt_string_vector words; |
---|
[329] | 2193 | |
---|
[2] | 2194 | |
---|
| 2195 | CmtSystem::split (arg, " \t,", words); |
---|
| 2196 | |
---|
| 2197 | for (int i = 0; i < words.size (); i++) |
---|
| 2198 | { |
---|
| 2199 | const cmt_string& a = words[i]; |
---|
| 2200 | |
---|
| 2201 | cmt_string s = ","; |
---|
| 2202 | s += a; |
---|
| 2203 | s += ","; |
---|
| 2204 | |
---|
| 2205 | if (cmt.m_extra_tags.find (s) == cmt_string::npos) |
---|
| 2206 | { |
---|
| 2207 | //if (!cmt.m_quiet) cerr << " a=[" << a << "]" << endl; |
---|
| 2208 | |
---|
| 2209 | /// Then restore uname if the specified tag is CMTCONFIG |
---|
| 2210 | if (a == CmtSystem::get_cmt_config ()) |
---|
| 2211 | { |
---|
| 2212 | Cmt::configure_uname_tag (); |
---|
| 2213 | } |
---|
| 2214 | |
---|
| 2215 | tag = Tag::add (a, PriorityUserTag, "arguments", 0); |
---|
| 2216 | |
---|
[568] | 2217 | tag->mark ("arguments"); |
---|
[2] | 2218 | |
---|
| 2219 | cmt.m_extra_tags += a; |
---|
| 2220 | cmt.m_extra_tags += ","; |
---|
| 2221 | } |
---|
| 2222 | } |
---|
[652] | 2223 | */ |
---|
[2] | 2224 | } |
---|
| 2225 | |
---|
| 2226 | void ArgParser::option_tag_remove () |
---|
| 2227 | { |
---|
[652] | 2228 | CmtSystem::cmt_string_vector words; |
---|
| 2229 | CmtSystem::split (arg, " \t,", words); |
---|
| 2230 | for (int i = 0; i < words.size (); i++) |
---|
| 2231 | { |
---|
| 2232 | bool has (false); |
---|
| 2233 | for (int j = 0; j < cmt.m_tags_remove.size (); j++) |
---|
| 2234 | { |
---|
| 2235 | if (cmt.m_tags_remove[j] == words[i]) |
---|
| 2236 | { |
---|
| 2237 | has = true; |
---|
| 2238 | break; |
---|
| 2239 | } |
---|
| 2240 | } |
---|
| 2241 | if (!has) |
---|
| 2242 | { |
---|
| 2243 | cmt.m_tags_remove.push_back (words[i]); |
---|
| 2244 | } |
---|
| 2245 | |
---|
| 2246 | for (int j = 0; j < cmt.m_extra_tags.size (); j++) |
---|
| 2247 | { |
---|
| 2248 | if (cmt.m_extra_tags[j] == words[i]) |
---|
| 2249 | { |
---|
| 2250 | cmt.m_extra_tags.erase(j); |
---|
| 2251 | break; |
---|
| 2252 | } |
---|
| 2253 | } |
---|
| 2254 | for (int j = 0; j < cmt.m_tags.size (); j++) |
---|
| 2255 | { |
---|
| 2256 | if (cmt.m_tags[j] == words[i]) |
---|
| 2257 | { |
---|
| 2258 | cmt.m_tags.erase(j); |
---|
| 2259 | break; |
---|
| 2260 | } |
---|
| 2261 | } |
---|
| 2262 | for (int j = 0; j < cmt.m_tags_add.size (); j++) |
---|
| 2263 | { |
---|
| 2264 | if (cmt.m_tags_add[j] == words[i]) |
---|
| 2265 | { |
---|
| 2266 | cmt.m_tags_add.erase(j); |
---|
| 2267 | break; |
---|
| 2268 | } |
---|
| 2269 | } |
---|
| 2270 | } |
---|
| 2271 | /* |
---|
[2] | 2272 | Tag::TagPtrVector tags = Tag::tags (); |
---|
| 2273 | int i; |
---|
| 2274 | Tag* tag; |
---|
| 2275 | |
---|
| 2276 | CmtSystem::cmt_string_vector words; |
---|
| 2277 | |
---|
| 2278 | //if (!cmt.m_quiet) cerr << "-arg_remove=" << arg << endl; |
---|
| 2279 | |
---|
| 2280 | CmtSystem::split (arg, " \t,", words); |
---|
| 2281 | |
---|
| 2282 | // |
---|
| 2283 | // Now erase all entries in the old list that match |
---|
| 2284 | // the specified tags |
---|
| 2285 | // |
---|
| 2286 | |
---|
| 2287 | for (i = 0; i < words.size (); i++) |
---|
| 2288 | { |
---|
| 2289 | const cmt_string& a = words[i]; |
---|
| 2290 | |
---|
| 2291 | cmt_string s = ","; |
---|
| 2292 | s += a; |
---|
| 2293 | s += ","; |
---|
| 2294 | |
---|
| 2295 | int pos; |
---|
| 2296 | |
---|
| 2297 | pos = cmt.m_extra_tags.find (s); |
---|
| 2298 | |
---|
| 2299 | if (pos != cmt_string::npos) |
---|
| 2300 | { |
---|
| 2301 | cmt.m_extra_tags.erase (pos, s.size () - 1); |
---|
| 2302 | } |
---|
| 2303 | |
---|
| 2304 | //if (!cmt.m_quiet) cerr << " tag_list=[" << tag_list << "]" << endl; |
---|
| 2305 | } |
---|
| 2306 | |
---|
| 2307 | // |
---|
| 2308 | // Now reinject the purged list of tags into the database |
---|
| 2309 | // exactly as when using -tag=<tag-list> |
---|
| 2310 | // |
---|
| 2311 | |
---|
| 2312 | /// First forget about all existing tags |
---|
| 2313 | Tag::unmark_all (); |
---|
| 2314 | |
---|
| 2315 | /// Then restore CMTSITE |
---|
| 2316 | Cmt::configure_version_tag (); |
---|
| 2317 | Cmt::configure_site_tag (0); |
---|
| 2318 | Cmt::configure_uname_tag (); |
---|
| 2319 | Cmt::configure_hosttype_tag (); |
---|
| 2320 | |
---|
| 2321 | CmtSystem::split (cmt.m_extra_tags, " \t,", words); |
---|
| 2322 | |
---|
| 2323 | for (i = 0; i < words.size (); i++) |
---|
| 2324 | { |
---|
| 2325 | const cmt_string& a = words[i]; |
---|
| 2326 | |
---|
| 2327 | /// Then restore uname if the specified tag is CMTCONFIG |
---|
| 2328 | if (a == CmtSystem::get_cmt_config ()) |
---|
| 2329 | { |
---|
| 2330 | Cmt::configure_uname_tag (); |
---|
| 2331 | } |
---|
| 2332 | |
---|
| 2333 | if (i == 0) |
---|
| 2334 | { |
---|
| 2335 | cmt.m_current_tag = a; |
---|
| 2336 | |
---|
| 2337 | //if (!cmt.m_quiet) cerr << "parse_argument(tag_remove)> current_tag=" |
---|
| 2338 | //<< cmt.m_current_tag << endl; |
---|
| 2339 | |
---|
[568] | 2340 | tag = Tag::add (a, PriorityTag, "arguments", 0); |
---|
[2] | 2341 | } |
---|
| 2342 | else |
---|
| 2343 | { |
---|
[568] | 2344 | tag = Tag::add (a, PriorityUserTag, "arguments", 0); |
---|
[2] | 2345 | } |
---|
| 2346 | |
---|
[568] | 2347 | tag->mark ("arguments"); |
---|
[2] | 2348 | } |
---|
[652] | 2349 | */ |
---|
[2] | 2350 | } |
---|
| 2351 | |
---|
| 2352 | void ArgParser::option_user_context () |
---|
| 2353 | { |
---|
| 2354 | if (CmtSystem::test_directory (arg)) |
---|
| 2355 | { |
---|
| 2356 | cmt.m_cmt_user_context = arg; |
---|
| 2357 | } |
---|
| 2358 | } |
---|
| 2359 | |
---|
[561] | 2360 | void ArgParser::option_with_cmt () |
---|
| 2361 | { |
---|
| 2362 | cmt.m_use_cmt = true; |
---|
[565] | 2363 | if (!Cmt::add_cmt_flag ("-with_cmt")) |
---|
| 2364 | CmtMessage::error ("Cannot add flag `-with_cmt'"); |
---|
[561] | 2365 | } |
---|
| 2366 | |
---|
| 2367 | void ArgParser::option_without_cmt () |
---|
| 2368 | { |
---|
| 2369 | cmt.m_use_cmt = false; |
---|
[565] | 2370 | if (!Cmt::add_cmt_flag ("-without_cmt")) |
---|
| 2371 | CmtMessage::error ("Cannot add flag `-without_cmt'"); |
---|
[561] | 2372 | } |
---|
| 2373 | |
---|
[656] | 2374 | void ArgParser::option_with_projects () |
---|
| 2375 | { |
---|
| 2376 | cmt.m_use_projects = true; |
---|
| 2377 | if (!Cmt::add_cmt_flag ("-with_projects")) |
---|
| 2378 | CmtMessage::error ("Cannot add flag `-with_projects'"); |
---|
| 2379 | } |
---|
| 2380 | |
---|
| 2381 | void ArgParser::option_without_projects () |
---|
| 2382 | { |
---|
| 2383 | cmt.m_use_projects = false; |
---|
| 2384 | if (!Cmt::add_cmt_flag ("-without_projects")) |
---|
| 2385 | CmtMessage::error ("Cannot add flag `-without_projects'"); |
---|
| 2386 | } |
---|
| 2387 | |
---|
[2] | 2388 | void ArgParser::option_with_version_directory () |
---|
| 2389 | { |
---|
| 2390 | cmt.m_current_structuring_style = with_version_directory; |
---|
[83] | 2391 | |
---|
[652] | 2392 | if (!Cmt::add_cmt_flag ("-with_version_directory")) |
---|
| 2393 | CmtError::set (CmtError::system_error, "Cannot add flag `-with_version_directory'"); |
---|
| 2394 | |
---|
[2] | 2395 | } |
---|
| 2396 | |
---|
| 2397 | void ArgParser::option_without_version_directory () |
---|
| 2398 | { |
---|
| 2399 | cmt.m_current_structuring_style = without_version_directory; |
---|
[83] | 2400 | |
---|
[652] | 2401 | if (!Cmt::add_cmt_flag ("-without_version_directory")) |
---|
| 2402 | CmtError::set (CmtError::system_error, "Cannot add flag `-without_version_directory'"); |
---|
| 2403 | |
---|
[2] | 2404 | } |
---|
| 2405 | |
---|
| 2406 | void ArgParser::option_no_cleanup () |
---|
| 2407 | { |
---|
[15] | 2408 | //cmt.m_current_setup_strategy |= SetupNoCleanup; |
---|
[2] | 2409 | } |
---|
| 2410 | |
---|
| 2411 | void ArgParser::option_private () |
---|
| 2412 | { |
---|
| 2413 | cmt.m_scope_filtering_mode = reach_private_uses; |
---|
| 2414 | } |
---|
| 2415 | |
---|
| 2416 | void ArgParser::option_public () |
---|
| 2417 | { |
---|
| 2418 | cmt.m_scope_filtering_mode = block_private_uses; |
---|
| 2419 | } |
---|
| 2420 | |
---|
| 2421 | |
---|
| 2422 | |
---|
| 2423 | |
---|
| 2424 | |
---|
| 2425 | |
---|
| 2426 | CommandHelp::HelpMap& CommandHelp::get_help () |
---|
| 2427 | { |
---|
| 2428 | static CommandHelp& me = instance (); |
---|
| 2429 | |
---|
| 2430 | return (me.m_help); |
---|
| 2431 | } |
---|
| 2432 | |
---|
| 2433 | CommandHelp::HelpTexts& CommandHelp::get_help_texts () |
---|
| 2434 | { |
---|
| 2435 | static CommandHelp& me = instance (); |
---|
| 2436 | |
---|
| 2437 | return (me.m_help_texts); |
---|
| 2438 | } |
---|
| 2439 | |
---|
| 2440 | const cmt_string& CommandHelp::get_help_text (ActionType key) |
---|
| 2441 | { |
---|
| 2442 | static const HelpTexts& help = get_help_texts (); |
---|
| 2443 | |
---|
| 2444 | const cmt_string& h = help[key]; |
---|
| 2445 | return (h); |
---|
| 2446 | } |
---|
| 2447 | |
---|
| 2448 | void CommandHelp::show_all () |
---|
| 2449 | { |
---|
| 2450 | static HelpTexts& help_texts = get_help_texts (); |
---|
| 2451 | |
---|
[590] | 2452 | cout << "#> cmt command [option...]" << endl; |
---|
| 2453 | cout << "# command :" << endl; |
---|
[2] | 2454 | |
---|
| 2455 | int i; |
---|
| 2456 | |
---|
| 2457 | for (i = 0; ; i++) |
---|
| 2458 | { |
---|
| 2459 | const cmt_string& s = help_texts[i]; |
---|
| 2460 | if (s == "") break; |
---|
[590] | 2461 | cout << "# " << s << endl; |
---|
[2] | 2462 | } |
---|
| 2463 | |
---|
[590] | 2464 | cout << "# global options :" << endl; |
---|
[2] | 2465 | |
---|
[590] | 2466 | cout << "# -disable_warnings : don't print warnings" << endl; |
---|
| 2467 | cout << "# -quiet : don't print errors" << endl; |
---|
| 2468 | cout << "# -use=<p>:<v>:<path> : set package version path" << endl; |
---|
| 2469 | cout << "# -pack=<package> : set package" << endl; |
---|
| 2470 | cout << "# -version=<version> : set version" << endl; |
---|
| 2471 | cout << "# -path=<path> : set root path" << endl; |
---|
| 2472 | cout << "# -f=<requirements-file> : set input file" << endl; |
---|
[652] | 2473 | cout << "# -e=<statement(s)> : add (multiple) statement(s)" << endl; |
---|
[590] | 2474 | cout << "# -tag=<tag-list> : select a new tag-set" << endl; |
---|
| 2475 | cout << "# -tag_add=<tag-list> : add specific comma-separated tag(s)" << endl; |
---|
| 2476 | cout << "# -tag_remove=<tag-list> : remove specific comma-separated tag(s)" << endl; |
---|
| 2477 | cout << "# -warnings : display various warnings" << endl; |
---|
| 2478 | cout << "# -with_version_directory : reset to default structuring style" << endl; |
---|
| 2479 | cout << "# -without_version_directory : switch structuring style" << endl; |
---|
| 2480 | cout << "# -cleanup : activate install area cleanup" << endl; |
---|
| 2481 | cout << "# -no_cleanup : inhibit install area cleanup" << endl; |
---|
| 2482 | cout << "# -xml : output in XML format (cmt setup, cmt show projects, cmt show uses)" << endl; |
---|
[652] | 2483 | cout << "# -user_context=<path> : set user context package/project directory" << endl; |
---|
| 2484 | cout << "# -home=<path> : set home package/project directory" << endl; |
---|
[2] | 2485 | } |
---|
| 2486 | |
---|
| 2487 | void CommandHelp::show (ActionType action) |
---|
| 2488 | { |
---|
[588] | 2489 | // cerr << "CommandHelp::show> action = " << action << endl; |
---|
[2] | 2490 | |
---|
| 2491 | static HelpTexts& help_texts = get_help_texts (); |
---|
| 2492 | |
---|
| 2493 | if (action == action_build) |
---|
| 2494 | { |
---|
[561] | 2495 | const cmt_string& s = get_help_text (action); |
---|
[590] | 2496 | cout << "# " << s << endl; |
---|
[2] | 2497 | int i; |
---|
| 2498 | |
---|
| 2499 | for (i = action_build_constituent_makefile; i <= action_build_windefs; i++) |
---|
| 2500 | { |
---|
| 2501 | const cmt_string& s = help_texts[i]; |
---|
[590] | 2502 | cout << "# " << s << endl; |
---|
[2] | 2503 | } |
---|
| 2504 | } |
---|
[561] | 2505 | else if (action == action_check) |
---|
[2] | 2506 | { |
---|
| 2507 | int i; |
---|
| 2508 | |
---|
| 2509 | for (i = action_check_configuration; i <= action_check_version; i++) |
---|
| 2510 | { |
---|
| 2511 | const cmt_string& s = help_texts[i]; |
---|
[590] | 2512 | cout << "# " << s << endl; |
---|
[2] | 2513 | } |
---|
| 2514 | } |
---|
| 2515 | else if (action == action_show) |
---|
| 2516 | { |
---|
| 2517 | int i; |
---|
| 2518 | |
---|
| 2519 | for (i = (action_show + 1); i <= action_show_versions; i++) |
---|
| 2520 | { |
---|
| 2521 | const cmt_string& s = help_texts[i]; |
---|
[590] | 2522 | cout << "# " << s << endl; |
---|
[2] | 2523 | } |
---|
| 2524 | } |
---|
| 2525 | else |
---|
| 2526 | { |
---|
| 2527 | const cmt_string& s = get_help_text (action); |
---|
[590] | 2528 | cout << "# " << s << endl; |
---|
[2] | 2529 | } |
---|
| 2530 | } |
---|
| 2531 | |
---|
| 2532 | CommandHelp& CommandHelp::instance () |
---|
| 2533 | { |
---|
| 2534 | static CommandHelp me; |
---|
| 2535 | return (me); |
---|
| 2536 | } |
---|
| 2537 | |
---|
| 2538 | CommandHelp::CommandHelp () |
---|
| 2539 | { |
---|
| 2540 | static HelpMap& help = m_help; |
---|
| 2541 | |
---|
| 2542 | static HelpTexts& help_texts = m_help_texts; |
---|
| 2543 | |
---|
| 2544 | help_texts.clear (); |
---|
| 2545 | |
---|
| 2546 | help_texts.add () = "none"; |
---|
| 2547 | help_texts.add () = "awk"; |
---|
| 2548 | help_texts.add () = "broadcast [-select=list] [-exclude=list] [-local] [-global] [-begin=pattern] [-depth=n] <command> : apply a command to [some of] the used packages"; |
---|
[561] | 2549 | help_texts.add () = "build <argument> : build actions. Try 'cmt help build'"; |
---|
| 2550 | // help_texts.add () = "build <option> : build actions. (Try cmt help build)"; |
---|
| 2551 | help_texts.add () = "build constituent_makefile [-out=<path>] [-with_cmt] [-without_cmt] <constituent> : generate constituent Makefile fragment"; |
---|
| 2552 | help_texts.add () = "build constituent_config [-out=<path>] <constituent> : generate constituent Makefile fragment, also tag specific Makefile, and setup definitions file for constituent with associated tag (via -target_tag option, or action)"; |
---|
| 2553 | help_texts.add () = "build constituents_makefile [-out=<path>] : generate constituents Makefile"; |
---|
| 2554 | help_texts.add () = "build constituents_config [-out=<path>] [-with_cmt] [-without_cmt] : generate constituents Makefile, tag specific Makefile, and setup definitions file, also input requirements file for constituent(s) without associated tag"; |
---|
[588] | 2555 | help_texts.add () = "build broadcast_config [-out=<path>] : generate broadcast Makefile, and broadcast specific macros Makefile"; |
---|
[590] | 2556 | help_texts.add () = "build dependencies [-out=<path>] [-name=<constituent>] [-all_sources] [-no_stamps] [-I<directory>]... [-start_all FILE... -end_all] FILE... : generate dependencies for FILEs [of constituent <constituent>]"; |
---|
[2] | 2557 | help_texts.add () = "build library_links : build symbolic links towards all imported libraries"; |
---|
| 2558 | help_texts.add () = "build make_setup : build a compiled version of setup scripts"; |
---|
| 2559 | help_texts.add () = "build msdev : generate MSDEV files"; |
---|
| 2560 | help_texts.add () = "build CMT_pacman : generate PACMAN manifest file for CMT"; |
---|
| 2561 | help_texts.add () = "build vsnet : generate VS.NET files"; |
---|
| 2562 | help_texts.add () = "build os9_makefile : generate Makefile for OS9"; |
---|
| 2563 | help_texts.add () = "build prototype : generate prototype file"; |
---|
| 2564 | help_texts.add () = "build readme : generate README.html"; |
---|
| 2565 | help_texts.add () = "build tag_makefile : generate tag specific Makefile"; |
---|
| 2566 | help_texts.add () = "build temporary_name : generate a name for a temprary file"; |
---|
| 2567 | help_texts.add () = "build triggers <constituent> : generate library trigger file"; |
---|
[466] | 2568 | help_texts.add () = "build windefs [-name=NAME] [@commandfile] (objectfile|library)... : generate def file for Windows shared library [NAME]"; |
---|
[2] | 2569 | help_texts.add () = "check <option> : check actions. (Try cmt help check)"; |
---|
| 2570 | help_texts.add () = "check configuration : check configuration"; |
---|
| 2571 | help_texts.add () = "check files <old> <new> : compare two files and overrides <old> by <new> if different"; |
---|
| 2572 | help_texts.add () = "check version <name> : check if a name follows a version tag syntax "; |
---|
[496] | 2573 | help_texts.add () = "co | checkout : perform a cvs/svn checkout over a CMT package"; |
---|
[2] | 2574 | help_texts.add () = "cleanup [-csh|-sh|-bat] : generate a cleanup script"; |
---|
| 2575 | help_texts.add () = "config : generate setup and cleanup scripts"; |
---|
| 2576 | help_texts.add () = "create <package> <version> [<path>] : create and configure a new package"; |
---|
[22] | 2577 | help_texts.add () = "create_project <project> <name> [<path>] : create and configure a new project"; |
---|
[2] | 2578 | help_texts.add () = "cvsbranches <module> : display the subdirectories for a module"; |
---|
[42] | 2579 | help_texts.add () = "cvssubpackages <module> : display the subpackages for a module"; |
---|
| 2580 | help_texts.add () = "cvssubprojects <module> : display the subprojects for a module"; |
---|
[2] | 2581 | help_texts.add () = "cvstags <module> : display the CVS tags for a module"; |
---|
| 2582 | help_texts.add () = "do <action> [<param>=<value>] ... : Execute an action"; |
---|
| 2583 | help_texts.add () = "expand model <model> : "; |
---|
| 2584 | help_texts.add () = "filter <in> <out> : filter a file against CMT macros and env. variables"; |
---|
| 2585 | help_texts.add () = "help | -help | --help : display this help"; |
---|
| 2586 | help_texts.add () = "load"; |
---|
| 2587 | help_texts.add () = "lock [<p> <v> [<path>]] : lock a package"; |
---|
[181] | 2588 | help_texts.add () = "relocate : generate only setup scripts"; |
---|
[2] | 2589 | help_texts.add () = "remove <package> <version> [<path>] : remove a package version"; |
---|
| 2590 | help_texts.add () = "remove library_links : remove symbolic links towards all imported libraries"; |
---|
| 2591 | help_texts.add () = "run '<command>' : apply a command"; |
---|
| 2592 | help_texts.add () = "run_sequence <sequence file> : execute a cmt equence file"; |
---|
| 2593 | help_texts.add () = "set version <version> : generate a version file in the current package"; |
---|
| 2594 | help_texts.add () = "set versions : generate version files into packages"; |
---|
[549] | 2595 | help_texts.add () = "setup [-csh|-sh|-bat|-cmt|-requirements] : generate a setup script (or standalone requirements file from which generate the setup script)"; |
---|
[2] | 2596 | help_texts.add () = "show <option> : query actions. (Try cmt help show)"; |
---|
| 2597 | help_texts.add () = "show action <name> : a formatted action definition"; |
---|
| 2598 | help_texts.add () = "show action_value <name> : a raw action definition"; |
---|
[612] | 2599 | help_texts.add () = "show action_names [<regexp>] : all action names [matching <regexp>]"; |
---|
| 2600 | help_texts.add () = "show actions [<regexp>] : all action definitions [for names matching <regexp>]"; |
---|
| 2601 | help_texts.add () = "show alias <name> : a formatted alias definition"; |
---|
| 2602 | help_texts.add () = "show alias_value <name> : a raw alias definition"; |
---|
| 2603 | help_texts.add () = "show alias_names [<regexp>] : all alias names [matching <regexp>]"; |
---|
| 2604 | help_texts.add () = "show aliases [<regexp>] : all alias definitions [for names matching <regexp>]"; |
---|
[2] | 2605 | help_texts.add () = "show all_tags : all defined tags"; |
---|
| 2606 | help_texts.add () = "show applied_patterns : all patterns actually applied"; |
---|
| 2607 | help_texts.add () = "show author : package author"; |
---|
| 2608 | help_texts.add () = "show branches : added branches"; |
---|
[528] | 2609 | help_texts.add () = "show clients <package> [<version> [<path>]] : clients of <package> [of <version> [in <path>]]"; |
---|
[2] | 2610 | help_texts.add () = "show cmtpath_patterns : cmtpath_patterns"; |
---|
| 2611 | help_texts.add () = "show constituent <name>: constituent definition"; |
---|
| 2612 | help_texts.add () = "show constituent_names : constituent names"; |
---|
| 2613 | help_texts.add () = "show constituents : constituent definitions"; |
---|
[541] | 2614 | help_texts.add () = "show container [<path>]... : container package of current project [or <path>s projects]"; |
---|
[2] | 2615 | help_texts.add () = "show cycles : cycles in the use graph"; |
---|
| 2616 | help_texts.add () = "show fragment <name> : one fragment definition"; |
---|
| 2617 | help_texts.add () = "show fragments : fragment definitions"; |
---|
| 2618 | help_texts.add () = "show groups : group definitions"; |
---|
| 2619 | help_texts.add () = "show include_dirs : "; |
---|
| 2620 | help_texts.add () = "show language <name> : language definition"; |
---|
| 2621 | help_texts.add () = "show languages : language definitions"; |
---|
| 2622 | help_texts.add () = "show macro <name> : a formatted macro definition"; |
---|
| 2623 | help_texts.add () = "show macro_value <name> : a raw macro definition"; |
---|
[612] | 2624 | help_texts.add () = "show macro_names [<regexp>] : all macro names [matching <regexp>]"; |
---|
| 2625 | help_texts.add () = "show macros [<regexp>] : all macro definitions [for names matching <regexp>]"; |
---|
[2] | 2626 | help_texts.add () = "show manager : package manager"; |
---|
[528] | 2627 | help_texts.add () = "show packages [<path>]... : packages reachable from the current context [or <path>s]"; |
---|
[482] | 2628 | help_texts.add () = "show path [-d] : the package search paths list [in detail]"; |
---|
[2] | 2629 | help_texts.add () = "show pattern <name> : the pattern definition and usages"; |
---|
| 2630 | help_texts.add () = "show pattern_names : pattern names"; |
---|
| 2631 | help_texts.add () = "show patterns : the pattern definitions"; |
---|
| 2632 | help_texts.add () = "show projects : project definitions"; |
---|
[272] | 2633 | help_texts.add () = "show project author : project author"; |
---|
[2] | 2634 | help_texts.add () = "show setup : setup definitions"; |
---|
| 2635 | help_texts.add () = "show pwd : filtered current directory"; |
---|
| 2636 | help_texts.add () = "show set <name> : a formatted set definition"; |
---|
[612] | 2637 | help_texts.add () = "show set_names [<regexp>] : set names [matching <regexp>]"; |
---|
[2] | 2638 | help_texts.add () = "show set_value <name> : a raw set definition"; |
---|
[612] | 2639 | help_texts.add () = "show sets [<regexp>] : set definitions [for names matching <regexp>]"; |
---|
[2] | 2640 | help_texts.add () = "show strategies : all strategies (build & version)"; |
---|
| 2641 | help_texts.add () = "show tags : all currently active tags"; |
---|
[528] | 2642 | help_texts.add () = "show use_paths <package> : all use paths to the used <package>"; |
---|
[2] | 2643 | help_texts.add () = "show uses : used packages"; |
---|
| 2644 | help_texts.add () = "show version : version of the current package"; |
---|
[528] | 2645 | help_texts.add () = "show versions <package> : visible versions of the selected <package>"; |
---|
[2] | 2646 | help_texts.add () = "system : display the system tag"; |
---|
| 2647 | help_texts.add () = "unlock [<p> <v> [<path>]] : unlock a package"; |
---|
| 2648 | help_texts.add () = "version : version of CMT"; |
---|
| 2649 | help_texts.add () = ""; |
---|
| 2650 | |
---|
| 2651 | //"build <key> : build various components :" |
---|
| 2652 | //"show <key> : display various infos on :" |
---|
| 2653 | |
---|
| 2654 | help.add (action_none, help_texts[action_none]); |
---|
| 2655 | help.add (action_awk, help_texts[action_awk]); |
---|
| 2656 | help.add (action_broadcast, help_texts[action_broadcast]); |
---|
| 2657 | help.add (action_build, help_texts[action_build]); |
---|
| 2658 | help.add (action_build_constituent_makefile, help_texts[action_build_constituent_makefile]); |
---|
[547] | 2659 | help.add (action_build_constituent_config, help_texts[action_build_constituent_config]); |
---|
[2] | 2660 | help.add (action_build_constituents_makefile, help_texts[action_build_constituents_makefile]); |
---|
[547] | 2661 | help.add (action_build_constituents_config, help_texts[action_build_constituents_config]); |
---|
[588] | 2662 | help.add (action_build_broadcast_config, help_texts[action_build_broadcast_config]); |
---|
[2] | 2663 | help.add (action_build_dependencies, help_texts[action_build_dependencies]); |
---|
| 2664 | help.add (action_build_library_links, help_texts[action_build_library_links]); |
---|
| 2665 | help.add (action_build_make_setup, help_texts[action_build_make_setup]); |
---|
| 2666 | help.add (action_build_msdev, help_texts[action_build_msdev]); |
---|
| 2667 | help.add (action_build_CMT_pacman, help_texts[action_build_CMT_pacman]); |
---|
| 2668 | help.add (action_build_vsnet, help_texts[action_build_vsnet]); |
---|
| 2669 | help.add (action_build_os9_makefile, help_texts[action_build_os9_makefile]); |
---|
| 2670 | help.add (action_build_prototype, help_texts[action_build_prototype]); |
---|
| 2671 | help.add (action_build_readme, help_texts[action_build_readme]); |
---|
| 2672 | help.add (action_build_tag_makefile, help_texts[action_build_tag_makefile]); |
---|
| 2673 | help.add (action_build_temporary_name, help_texts[action_build_temporary_name]); |
---|
| 2674 | help.add (action_build_triggers, help_texts[action_build_triggers]); |
---|
| 2675 | help.add (action_build_windefs, help_texts[action_build_windefs]); |
---|
| 2676 | help.add (action_check_configuration, help_texts[action_check_configuration]); |
---|
| 2677 | help.add (action_check_files, help_texts[action_check_files]); |
---|
| 2678 | help.add (action_check_version, help_texts[action_check_version]); |
---|
| 2679 | help.add (action_checkout, help_texts[action_checkout]); |
---|
| 2680 | help.add (action_cleanup, help_texts[action_cleanup]); |
---|
| 2681 | help.add (action_config, help_texts[action_config]); |
---|
| 2682 | help.add (action_create, help_texts[action_create]); |
---|
| 2683 | help.add (action_create_project, help_texts[action_create_project]); |
---|
| 2684 | help.add (action_cvsbranches, help_texts[action_cvsbranches]); |
---|
| 2685 | help.add (action_cvssubpackages, help_texts[action_cvssubpackages]); |
---|
[42] | 2686 | help.add (action_cvssubprojects, help_texts[action_cvssubprojects]); |
---|
[2] | 2687 | help.add (action_cvstags, help_texts[action_cvstags]); |
---|
| 2688 | help.add (action_do, help_texts[action_do]); |
---|
| 2689 | help.add (action_expand_model, help_texts[action_expand_model]); |
---|
| 2690 | help.add (action_filter, help_texts[action_filter]); |
---|
| 2691 | help.add (action_help, help_texts[action_help]); |
---|
| 2692 | help.add (action_load, help_texts[action_load]); |
---|
| 2693 | help.add (action_lock, help_texts[action_lock]); |
---|
[181] | 2694 | help.add (action_relocate, help_texts[action_relocate]); |
---|
[2] | 2695 | help.add (action_remove, help_texts[action_remove]); |
---|
| 2696 | help.add (action_remove_library_links, help_texts[action_remove_library_links]); |
---|
| 2697 | help.add (action_run, help_texts[action_run]); |
---|
| 2698 | help.add (action_run_sequence, help_texts[action_run_sequence]); |
---|
| 2699 | help.add (action_set_version, help_texts[action_set_version]); |
---|
| 2700 | help.add (action_set_versions, help_texts[action_set_versions]); |
---|
| 2701 | help.add (action_setup, help_texts[action_setup]); |
---|
| 2702 | help.add (action_show, help_texts[action_show]); |
---|
| 2703 | help.add (action_show_action, help_texts[action_show_action]); |
---|
| 2704 | help.add (action_show_action_value, help_texts[action_show_action_value]); |
---|
| 2705 | help.add (action_show_action_names, help_texts[action_show_action_names]); |
---|
| 2706 | help.add (action_show_actions, help_texts[action_show_actions]); |
---|
[612] | 2707 | help.add (action_show_alias, help_texts[action_show_alias]); |
---|
| 2708 | help.add (action_show_alias_value, help_texts[action_show_alias_value]); |
---|
| 2709 | help.add (action_show_alias_names, help_texts[action_show_alias_names]); |
---|
| 2710 | help.add (action_show_aliases, help_texts[action_show_aliases]); |
---|
[2] | 2711 | help.add (action_show_all_tags, help_texts[action_show_all_tags]); |
---|
| 2712 | help.add (action_show_applied_patterns, help_texts[action_show_applied_patterns]); |
---|
| 2713 | help.add (action_show_author, help_texts[action_show_author]); |
---|
| 2714 | help.add (action_show_branches, help_texts[action_show_branches]); |
---|
| 2715 | help.add (action_show_clients, help_texts[action_show_clients]); |
---|
| 2716 | help.add (action_show_cmtpath_patterns, help_texts[action_show_cmtpath_patterns]); |
---|
| 2717 | help.add (action_show_constituent, help_texts[action_show_constituent]); |
---|
| 2718 | help.add (action_show_constituent_names, help_texts[action_show_constituent_names]); |
---|
| 2719 | help.add (action_show_constituents, help_texts[action_show_constituents]); |
---|
[525] | 2720 | help.add (action_show_container, help_texts[action_show_container]); |
---|
[2] | 2721 | help.add (action_show_cycles, help_texts[action_show_cycles]); |
---|
| 2722 | help.add (action_show_fragment, help_texts[action_show_fragment]); |
---|
| 2723 | help.add (action_show_fragments, help_texts[action_show_fragments]); |
---|
| 2724 | help.add (action_show_groups, help_texts[action_show_groups]); |
---|
| 2725 | help.add (action_show_include_dirs, help_texts[action_show_include_dirs]); |
---|
| 2726 | help.add (action_show_language, help_texts[action_show_language]); |
---|
| 2727 | help.add (action_show_languages, help_texts[action_show_languages]); |
---|
| 2728 | help.add (action_show_macro, help_texts[action_show_macro]); |
---|
| 2729 | help.add (action_show_macro_value, help_texts[action_show_macro_value]); |
---|
| 2730 | help.add (action_show_macro_names, help_texts[action_show_macro_names]); |
---|
| 2731 | help.add (action_show_macros, help_texts[action_show_macros]); |
---|
| 2732 | help.add (action_show_manager, help_texts[action_show_manager]); |
---|
| 2733 | help.add (action_show_packages, help_texts[action_show_packages]); |
---|
| 2734 | help.add (action_show_path, help_texts[action_show_path]); |
---|
| 2735 | help.add (action_show_pattern, help_texts[action_show_pattern]); |
---|
| 2736 | help.add (action_show_pattern_names, help_texts[action_show_pattern_names]); |
---|
| 2737 | help.add (action_show_patterns, help_texts[action_show_patterns]); |
---|
| 2738 | help.add (action_show_projects, help_texts[action_show_projects]); |
---|
[272] | 2739 | help.add (action_show_project_author, help_texts[action_show_project_author]); |
---|
[2] | 2740 | help.add (action_show_setup, help_texts[action_show_setup]); |
---|
| 2741 | help.add (action_show_pwd, help_texts[action_show_pwd]); |
---|
| 2742 | help.add (action_show_set, help_texts[action_show_set]); |
---|
| 2743 | help.add (action_show_set_names, help_texts[action_show_set_names]); |
---|
| 2744 | help.add (action_show_set_value, help_texts[action_show_set_value]); |
---|
| 2745 | help.add (action_show_sets, help_texts[action_show_sets]); |
---|
| 2746 | help.add (action_show_strategies, help_texts[action_show_strategies]); |
---|
| 2747 | help.add (action_show_tags, help_texts[action_show_tags]); |
---|
| 2748 | help.add (action_show_use_paths, help_texts[action_show_use_paths]); |
---|
| 2749 | help.add (action_show_uses, help_texts[action_show_uses]); |
---|
| 2750 | help.add (action_show_version, help_texts[action_show_version]); |
---|
| 2751 | help.add (action_show_versions, help_texts[action_show_versions]); |
---|
| 2752 | help.add (action_system, help_texts[action_system]); |
---|
| 2753 | help.add (action_unlock, help_texts[action_unlock]); |
---|
| 2754 | help.add (action_version, help_texts[action_version]); |
---|
| 2755 | } |
---|
| 2756 | |
---|