Class: Kashi::CLI

Inherits:
Object
  • Object
show all
Defined in:
lib/kashi/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.



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

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

Class Method Details

.start(argv) ⇒ Object



6
7
8
# File 'lib/kashi/cli.rb', line 6

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

Instance Method Details

#runObject



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

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