Class: Opal::Vite::CLI

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

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.



7
8
9
10
# File 'lib/opal/vite/cli.rb', line 7

def initialize(argv)
  @argv = argv
  @options = {}
end

Instance Method Details

#runObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/opal/vite/cli.rb', line 12

def run
  command = @argv.shift

  case command
  when 'compile'
    compile_command
  when 'version', '-v', '--version'
    version_command
  when 'help', '-h', '--help', nil
    help_command
  else
    puts "Unknown command: #{command}"
    puts "Run 'opal-vite help' for usage information"
    exit 1
  end
end