Class: Bucketrb::CLI

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

Constant Summary collapse

DEFAULT_HOST =
"127.0.0.1"
DEFAULT_PORT =
4566
DEFAULT_ROOT =
"data/bucketrb"
BUCKET_ENV_PATTERN =
/(?:^|_)(?:S3_)?BUCKET$/

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ CLI

Returns a new instance of CLI.



18
19
20
# File 'lib/bucketrb/cli.rb', line 18

def initialize(argv)
  @argv = argv.dup
end

Instance Method Details

#runObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/bucketrb/cli.rb', line 22

def run
  command = @argv.shift

  case command
  when "serve"
    serve
  when "version", "--version", "-v"
    puts Bucketrb::VERSION
    0
  when "help", "--help", "-h", nil
    puts parser
    0
  else
    warn "Unknown command: #{command}"
    warn parser
    1
  end
end