Class: Trainer::CommandsGenerator

Inherits:
Object
  • Object
show all
Includes:
Commander::Methods
Defined in:
lib/trainer/commands_generator.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.startObject



9
10
11
# File 'lib/trainer/commands_generator.rb', line 9

def self.start
  self.new.run
end

Instance Method Details

#runObject



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
38
39
40
41
# File 'lib/trainer/commands_generator.rb', line 13

def run
  program :version, Trainer::VERSION
  program :description, Trainer::DESCRIPTION
  program :help, 'Author', 'Felix Krause <[email protected]>'
  program :help, 'Website', 'https://fastlane.tools'
  program :help, 'GitHub', 'https://github.com/KrauseFx/trainer'
  program :help_formatter, :compact

  global_option('--verbose', 'Shows a more verbose output') { $verbose = true }

  always_trace!

  FastlaneCore::CommanderGenerator.new.generate(Trainer::Options.available_options)

  command :run do |c|
    c.syntax = 'trainer'
    c.description = Trainer::DESCRIPTION

    c.action do |args, options|
      options = FastlaneCore::Configuration.create(Trainer::Options.available_options, options.__hash__)
      FastlaneCore::PrintTable.print_values(config: options, title: "Summary for trainer #{Trainer::VERSION}") if $verbose
      Trainer::TestParser.auto_convert(options)
    end
  end

  default_command :run

  run!
end