Class: Applb::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/applb/cli.rb

Defined Under Namespace

Classes: Apply, Export

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/applb/cli.rb', line 11

def initialize(argv)
  @argv = argv.dup
  @help = argv.empty?
  @filepath = 'ALBfile'
  @options = {
    color: true,
    includes: [],
    excludes: [],
  }
  parser.order!(@argv)
end

Class Method Details

.start(argv) ⇒ Object



7
8
9
# File 'lib/applb/cli.rb', line 7

def self.start(argv)
  new(argv).run
end

Instance Method Details

#runObject



23
24
25
26
27
28
29
30
31
# File 'lib/applb/cli.rb', line 23

def run
  if @help
    puts parser.help
  elsif @apply
    Apply.new(@filepath, @options).run
  elsif @export
    Export.new(@filepath, @options).run
  end
end