Class: TlaParserS::Cli
- Inherits:
-
Thor
- Object
- Thor
- TlaParserS::Cli
- Includes:
- Utils::MyLogger
- Defined in:
- lib/cli/cli.rb
Constant Summary collapse
- PROGNAME =
logger progname
"main"
- VERSION_BANNER =
<<-EOS #{File.basename $0} - #{TlaParserS::version} EOS
Constants included from Utils::MyLogger
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(*args) ⇒ Cli
constructor
—————————————————————— constructore.
- #resolve(*entrypoints) ⇒ Object
- #version ⇒ Object
Methods included from Utils::MyLogger
Constructor Details
Class Method Details
.add_shared_option(name, options = {}) ⇒ Object
21 22 23 24 |
# File 'lib/cli/cli.rb', line 21 def add_shared_option(name, = {}) @shared_options = {} if @shared_options.nil? @shared_options[name] = end |
.shared_options(*option_names) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/cli/cli.rb', line 26 def (*option_names) option_names.each do |option_name| opt = @shared_options[option_name] raise "Tried to access shared option '#{option_name}' but it was not previously defined" if opt.nil? yield option_name, opt if block_given? option option_name, opt end end |
Instance Method Details
#resolve(*entrypoints) ⇒ Object
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/cli/cli.rb', line 75 def resolve( *entrypoints ) entries = [] # iterate globs and choose dirtory entries [:dir_globs].each { |glob| entries += Dir.glob( glob ).select { |path| File.file?(path ) } } @logger.info( "#{__method__} entries=#{entries}" ) result = TlaParserS::Resolver.new( ). initSnippets( entries.map { |fileName| File.new(fileName )} ). resolveModules( entrypoints ) @logger.info( "#{__method__} result=#{result}" ) puts result end |
#version ⇒ Object
60 61 62 |
# File 'lib/cli/cli.rb', line 60 def version() puts VERSION_BANNER end |