Class: Morpheus::Cli::SourceCommand
- Inherits:
-
Object
- Object
- Morpheus::Cli::SourceCommand
- Includes:
- CliCommand
- Defined in:
- lib/morpheus/cli/source_command.rb
Overview
This is for use in dotfile scripts and the shell..
Instance Attribute Summary
Attributes included from CliCommand
Instance Method Summary collapse
Methods included from CliCommand
#build_common_options, #build_option_type_options, #command_name, #default_subcommand, #establish_remote_appliance_connection, #handle_subcommand, included, #interactive?, #noninteractive, #print_usage, #subcommand_aliases, #subcommand_usage, #subcommands, #usage, #verify_access_token!
Instance Method Details
#handle(args) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/morpheus/cli/source_command.rb', line 11 def handle(args) append_newline = true = {} optparse = Morpheus::Cli::OptionParser.new do|opts| opts. = "Usage: morpheus #{command_name} [file] [file2]" (opts, , []) opts. = "This will execute a file, treatin it as a script of morpheus commands" end optparse.parse!(args) if args.count < 1 puts optparse return false # exit 1 end source_files = args source_files.each do |source_file| # execute a source script if File.exists?(source_file) cmd_results = Morpheus::Cli::DotFile.new(source_file).execute() else print_red_alert "file not found: '#{source_file}'" # return false end end return true end |