Class: Chemicalml::Cli::Base

Inherits:
Thor
  • Object
show all
Defined in:
lib/chemicalml/cli/base.rb

Overview

Thor-based dispatcher. Each command delegates to a dedicated Chemicalml::Cli::*Command class invoked as MyCommand.new.run(options), where options is a single hash carrying both positional args (keyed by name) and flags.

A Chemicalml::Logger bridged to Thor's shell is injected into every command — so info/warn/error get coloured output on the terminal while remaining loggable for library callers.

Instance Method Summary collapse

Instance Method Details

#constraintsObject



53
54
55
# File 'lib/chemicalml/cli/base.rb', line 53

def constraints
  ConstraintsCommand.new(logger: bridged_logger).run({})
end

#conventionsObject



38
39
40
# File 'lib/chemicalml/cli/base.rb', line 38

def conventions
  ConventionsCommand.new(logger: bridged_logger).run({})
end

#dictionariesObject



43
44
45
# File 'lib/chemicalml/cli/base.rb', line 43

def dictionaries
  DictionariesCommand.new(logger: bridged_logger).run({})
end

#elementsObject



48
49
50
# File 'lib/chemicalml/cli/base.rb', line 48

def elements
  ElementsCommand.new(logger: bridged_logger).run({})
end

#enumsObject



58
59
60
# File 'lib/chemicalml/cli/base.rb', line 58

def enums
  EnumsCommand.new(logger: bridged_logger).run({})
end

#info(element) ⇒ Object



63
64
65
# File 'lib/chemicalml/cli/base.rb', line 63

def info(element)
  InfoCommand.new(logger: bridged_logger).run(element: element)
end

#inspect(file) ⇒ Object



33
34
35
# File 'lib/chemicalml/cli/base.rb', line 33

def inspect(file)
  InspectCommand.new(logger: bridged_logger).run(file: file)
end

#validate(file) ⇒ Object



28
29
30
# File 'lib/chemicalml/cli/base.rb', line 28

def validate(file)
  ValidateCommand.new(logger: bridged_logger).run(file: file, json: options[:json])
end