class Pfm::CLI
def run
def run subcommand_name, *subcommand_params = argv ENV['DEBUG'] = true if verbose? # # Runs the appropriate subcommand if the given parameters contain any # subcommands. # if subcommand_name.nil? || option?(subcommand_name) handle_options elsif have_command?(subcommand_name) subcommand = instantiate_subcommand(subcommand_name) exit_code = subcommand.run_with_default_options(subcommand_params) exit normalized_exit_code(exit_code) else err "Unknown command `#{subcommand_name}'." show_help exit 1 end rescue OptionParser::InvalidOption => e err(e.message) show_help exit 1 end