Class: VpsAdminOS::Converter::Cli::Command

Inherits:
OsCtl::Lib::Cli::Command
  • Object
show all
Defined in:
lib/vpsadminos-converter/cli/command.rb

Direct Known Subclasses

Vz6::Base

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(global_opts, opts, args) ⇒ Command

Returns a new instance of Command.



12
13
14
15
16
17
18
19
20
# File 'lib/vpsadminos-converter/cli/command.rb', line 12

def initialize(global_opts, opts, args)
  super

  if gopts['log-file']
    OsCtl::Lib::Logger.setup(:io, io: File.open(gopts['log-file'], 'a'))
  else
    OsCtl::Lib::Logger.setup(:none)
  end
end

Class Method Details

.run(klass, method) ⇒ Object



5
6
7
8
9
10
# File 'lib/vpsadminos-converter/cli/command.rb', line 5

def self.run(klass, method)
  proc do |global_opts, opts, args|
    cmd = klass.new(global_opts, opts, args)
    cmd.method(method).call
  end
end