Class: SQA::Commands::Base

Inherits:
Dry::CLI::Command
  • Object
show all
Defined in:
lib/sqa/commands/base.rb

Overview

Establish a Base command class that has global options available to all commands.

Direct Known Subclasses

Analysis, Web

Constant Summary collapse

IGNORE_OPTIONS =

keys from Dry::Cli options which we do not want in the config object.

%i[ version ]

Instance Method Summary collapse

Instance Method Details

#call(params) ⇒ Object

All command class call methods should start with super so that this method is invoked.

params is a Hash from Dry::CLI where keys are Symbol



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'lib/sqa/commands/base.rb', line 102

def call(params)
  show_versions_and_exit if params[:version]

  unless params[:config_file].nil? || params[:config_file].empty?
    SQA.config.config_file = params[:config_file]
    SQA.config.from_file
  end

  update_config(params)

  unless params[:dump_config].nil? || params[:dump_config].empty?
    SQA.config.config_file = params[:dump_config]
    SQA.config.dump_file
  end

  SQA.config
end