Method: Roby::Application.common_optparse_setup
- Defined in:
- lib/roby/app.rb
.common_optparse_setup(parser) ⇒ Object
Defines common configuration options valid for all Roby-oriented scripts
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 |
# File 'lib/roby/app.rb', line 601 def self.common_optparse_setup(parser) Roby.app.load_config_yaml parser.on( "--set=KEY=VALUE", String, "set a value on the Conf object" ) do |value| Roby.app.argv_set << value apply_conf_from_argv(value) end parser.on( "--log=SPEC", String, "configuration specification for text loggers. SPEC is of the form "\ "path/to/a/module:LEVEL[:FILE][,path/to/another]" ) do |log_spec| log_spec.split(",").each do |spec| mod, level, file = spec.split(":") Roby.app.log_setup(mod, level, file) end end parser.on( "-r NAME", "--robot=NAME[,TYPE]", String, "the robot name and type" ) do |name| robot_name, robot_type = name.split(",") Roby.app.setup_robot_names_from_config_dir Roby.app.robot(robot_name, robot_type) end parser.on("--debug", "run in debug mode") do Roby.app.public_logs = true Roby.app.filter_backtraces = false require "roby/app/debug" end parser.on_tail("-h", "--help", "this help message") do STDERR.puts parser exit end end |