Changeset 561 for CMT/HEAD/source/cmt_commands.cxx
- Timestamp:
- Mar 8, 2011, 1:56:48 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
CMT/HEAD/source/cmt_commands.cxx
r550 r561 337 337 pv.push_back (&ArgParser::option_version); i++; 338 338 339 parsers.add ("-with_c", i); 340 parsers.add ("-with_cm", i); 341 parsers.add ("-with_cmt", i); 342 pv.push_back (&ArgParser::option_with_cmt); i++; 343 344 parsers.add ("-without_c", i); 345 parsers.add ("-without_cm", i); 346 parsers.add ("-without_cmt", i); 347 pv.push_back (&ArgParser::option_without_cmt); i++; 348 339 349 parsers.add ("-warn", i); 340 350 parsers.add ("-warni", i); … … 520 530 // We have unexpected arguments (not handled by the command handler). This may sign 521 531 // an unprotected handler implementation. 522 CmtMessage::warning ("unexpected parameter " + reduced_arg); 532 if (help_action != action_help) 533 CmtMessage::warning ("unexpected parameter " + reduced_arg); 523 534 // if (!cmt.m_quiet) cerr << "#CMT> warning : unexpected parameter " << reduced_arg << endl; 524 535 } … … 577 588 if (arg == "constituent_makefile") 578 589 { 579 // if (argc > 0) 580 if (argc == 1 || (argc == 2 && cmt_string (argv[0]).substr (0, 5) == "-out=")) 581 { 582 //fill_one_argument (); 583 fill_arguments (); 584 cmt.m_action = action_build_constituent_makefile; 585 } 586 else if (argc > 0) 587 { 588 CmtMessage::error ("syntax: wrong arguments"); 589 // if (!cmt.m_quiet) cerr << "#CMT> syntax error : wrong arguments" << endl; 590 cmt.m_action = action_build_constituent_makefile; 590 cmt.m_action = action_build_constituent_makefile; 591 bool need_name (true); 592 while (argc > 0) 593 { 594 cmt_string arg(argv[0]); 595 if (arg.substr (0, 5) == "-out=") 596 { 597 fill_one_argument (); 598 } 599 else if (arg == "-with_cmt") 600 { 601 shift (); 602 cmt.m_use_cmt = true; 603 } 604 else if (arg == "-without_cmt") 605 { 606 shift (); 607 cmt.m_use_cmt = false; 608 } 609 else if (need_name && arg != "") 610 { 611 need_name = false; 612 fill_one_argument (); 613 } 614 else 615 { 616 help_action = action_help; 617 CmtError::set (CmtError::syntax_error, arg + ": wrong argument"); 618 break; 619 } 620 } 621 if (need_name) 622 { 591 623 help_action = action_help; 592 } 593 else 594 { 595 CmtMessage::error ("syntax: constituent name missing"); 596 // if (!cmt.m_quiet) cerr << "#CMT> syntax error : constituent name missing" << endl; 597 cmt.m_action = action_build_constituent_makefile; 624 if (!CmtError::has_pending_error ()) 625 CmtError::set (CmtError::syntax_error, "argument(s) missing"); 626 } 627 } 628 else if (arg == "constituent_config") 629 { 630 cmt.m_action = action_build_constituent_config; 631 bool need_name (true); 632 while (argc > 0) 633 { 634 cmt_string arg(argv[0]); 635 if (arg.substr (0, 5) == "-out=") 636 { 637 fill_one_argument (); 638 } 639 else if (need_name && arg != "") 640 { 641 need_name = false; 642 fill_one_argument (); 643 } 644 else 645 { 646 help_action = action_help; 647 CmtError::set (CmtError::syntax_error, arg + ": wrong argument"); 648 break; 649 } 650 } 651 if (need_name) 652 { 598 653 help_action = action_help; 599 } 600 } 601 else if (arg == "constituent_config") 602 { 603 // if (argc > 0) 604 if (argc == 1 || 605 argc == 2 && 606 (cmt_string (argv[0]).substr (0, 5) == "-out=" || 607 cmt_string (argv[1]).substr (0, 5) == "-out=") 608 ) 609 { 610 //fill_one_argument (); 611 fill_arguments (); 612 cmt.m_action = action_build_constituent_config; 613 } 614 else if (argc > 0) 615 { 616 CmtMessage::error ("syntax: wrong arguments"); 617 // if (!cmt.m_quiet) cerr << "#CMT> syntax error : wrong arguments" << endl; 618 cmt.m_action = action_build_constituent_config; 619 help_action = action_help; 620 } 621 else 622 { 623 CmtMessage::error ("syntax: constituent name missing"); 624 // if (!cmt.m_quiet) cerr << "#CMT> syntax error : constituent name missing" << endl; 625 cmt.m_action = action_build_constituent_config; 626 help_action = action_help; 654 if (!CmtError::has_pending_error ()) 655 CmtError::set (CmtError::syntax_error, "argument(s) missing"); 627 656 } 628 657 } 629 658 else if (arg == "constituents_makefile") 630 659 { 631 fill_arguments ();632 660 cmt.m_action = action_build_constituents_makefile; 661 while (argc > 0) 662 { 663 cmt_string arg(argv[0]); 664 if (arg.substr (0, 5) == "-out=") 665 { 666 fill_one_argument (); 667 } 668 else 669 { 670 help_action = action_help; 671 CmtError::set (CmtError::syntax_error, arg + ": wrong argument"); 672 break; 673 } 674 } 633 675 } 634 676 else if (arg == "constituents_config") 635 677 { 636 fill_arguments ();637 678 cmt.m_action = action_build_constituents_config; 679 while (argc > 0) 680 { 681 cmt_string arg(argv[0]); 682 if (arg.substr (0, 5) == "-out=" || 683 arg == "-with_cmt" || 684 arg == "-without_cmt") 685 { 686 fill_one_argument (); 687 } 688 else 689 { 690 help_action = action_help; 691 CmtError::set (CmtError::syntax_error, arg + ": wrong argument"); 692 break; 693 } 694 } 638 695 } 639 696 else if (arg == "dependencies") … … 759 816 else 760 817 { 761 CmtMessage::error ("syntax: wrong build argument"); 818 CmtError::set (CmtError::syntax_error, "wrong argument: " + arg); 819 //CmtMessage::error ("syntax: wrong build argument: " + arg); 762 820 // if (!cmt.m_quiet) cerr << "#CMT> syntax error : wrong build argument" << endl; 763 821 help_action = action_help; … … 767 825 else 768 826 { 769 CmtMessage::error ("syntax: don't know what to build"); 827 cmt.m_action = action_build; 828 if (help_action != action_help) 829 { 830 help_action = action_help; 831 CmtError::set (CmtError::syntax_error, "argument(s) missing"); 832 //CmtMessage::error ("syntax: don't know what to build"); 770 833 // if (!cmt.m_quiet) cerr << "#CMT> syntax error : don't know what to build" << endl; 771 help_action = action_help; 772 cmt.m_action = action_build; 834 } 773 835 } 774 836 } … … 2129 2191 } 2130 2192 2193 void ArgParser::option_with_cmt () 2194 { 2195 cmt.m_use_cmt = true; 2196 } 2197 2198 void ArgParser::option_without_cmt () 2199 { 2200 cmt.m_use_cmt = false; 2201 } 2202 2131 2203 void ArgParser::option_with_version_directory () 2132 2204 { … … 2219 2291 cerr << "# -version=<version> : set version" << endl; 2220 2292 cerr << "# -path=<path> : set root path" << endl; 2221 cerr << "# -f=<requirement -file>: set input file" << endl;2293 cerr << "# -f=<requirements-file> : set input file" << endl; 2222 2294 cerr << "# -e=<statement> : add a one line statement" << endl; 2223 2295 cerr << "# -tag=<tag-list> : select a new tag-set" << endl; … … 2240 2312 if (action == action_build) 2241 2313 { 2314 const cmt_string& s = get_help_text (action); 2315 cerr << "# " << s << endl; 2242 2316 int i; 2243 2317 … … 2248 2322 } 2249 2323 } 2250 if (action == action_check)2324 else if (action == action_check) 2251 2325 { 2252 2326 int i; … … 2271 2345 { 2272 2346 const cmt_string& s = get_help_text (action); 2273 cerr << "# " << s << endl;2347 cerr << "# " << s << endl; 2274 2348 } 2275 2349 } … … 2292 2366 help_texts.add () = "awk"; 2293 2367 help_texts.add () = "broadcast [-select=list] [-exclude=list] [-local] [-global] [-begin=pattern] [-depth=n] <command> : apply a command to [some of] the used packages"; 2294 help_texts.add () = "build <option> : build actions. (Try cmt help build)"; 2295 help_texts.add () = "build constituent_makefile <constituent> : generate constituent Makefile fragment"; 2296 help_texts.add () = "build constituent_config <constituent> : generate constituent Makefile fragment, also tag specific Makefile, and setup definitions file, if constituent has associated tag (via -target_tag option, or is action)"; 2297 help_texts.add () = "build constituents_makefile : generate constituents.make"; 2298 help_texts.add () = "build constituents_config : generate constituents.make, tag specific Makefile, and setup definitions file"; 2368 help_texts.add () = "build <argument> : build actions. Try 'cmt help build'"; 2369 // help_texts.add () = "build <option> : build actions. (Try cmt help build)"; 2370 help_texts.add () = "build constituent_makefile [-out=<path>] [-with_cmt] [-without_cmt] <constituent> : generate constituent Makefile fragment"; 2371 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)"; 2372 help_texts.add () = "build constituents_makefile [-out=<path>] : generate constituents Makefile"; 2373 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"; 2299 2374 help_texts.add () = "build dependencies : generate dependencies"; 2300 2375 help_texts.add () = "build library_links : build symbolic links towards all imported libraries";
Note: See TracChangeset
for help on using the changeset viewer.