Class: Contained::CLI
- Inherits:
-
Object
- Object
- Contained::CLI
- Defined in:
- lib/contained/cli.rb,
lib/contained/cli/base.rb,
lib/contained/cli/init.rb,
lib/contained/cli/setup.rb,
lib/contained/cli/deploy.rb
Overview
Defined Under Namespace
Classes: Base, Deploy, Init, Setup
Instance Method Summary collapse
-
#initialize(stdin: $stdin, stdout: $stdout, argv: ARGV) ⇒ CLI
constructor
A new instance of CLI.
- #parse ⇒ Object
Constructor Details
#initialize(stdin: $stdin, stdout: $stdout, argv: ARGV) ⇒ CLI
Returns a new instance of CLI.
14 15 16 17 18 |
# File 'lib/contained/cli.rb', line 14 def initialize(stdin: $stdin, stdout: $stdout, argv: ARGV) @stdin = stdin @stdout = stdout @argv = argv end |
Instance Method Details
#parse ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/contained/cli.rb', line 20 def parse parser.order!(@argv) command = @argv.shift return if command.nil? handler = case command when "init" then ::Contained::CLI::Init when "setup" then ::Contained::CLI::Setup when "deploy" then ::Contained::CLI::Deploy else raise ::Contained::Error, "unsupported command=#{command.inspect}" end handler.handle!(stdin: @stdin, stdout: @stdout, argv: @argv) end |