Class: Wavesync::CLI

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

Class Method Summary collapse

Class Method Details

.startObject

: () -> void



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

def self.start
  command_name = ARGV.first && !ARGV.first.start_with?('-') ? ARGV.shift : 'sync'
  command_class = Commands::ALL.find { |cmd| command_name == cmd.name }

  if command_class
    command_class.new.run
  else
    puts "Unknown command: #{command_name}"
    puts "Available commands: #{Commands::ALL.map(&:name).join(', ')}"
    exit 1
  end
end