Module: S3Sync::CLI

Defined in:
lib/s3sync/cli.rb

Defined Under Namespace

Classes: BaseCmd, CreateBucket, Delete, DeleteBucket, Get, List, ListBuckets, Put, Sync, Url

Constant Summary collapse

AVAILABLE_ACLS =
[:public_read, :public_read_write, :private]
AVAILABLE_METHODS =
['read', 'get', 'put', 'write', 'delete']

Class Method Summary collapse

Class Method Details

.run(conf) ⇒ Object



427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
# File 'lib/s3sync/cli.rb', line 427

def run conf
  cmd = CmdParse::CommandParser.new true
  cmd.program_name = File.basename $0
  cmd.program_version = S3Sync::VERSION

  cmd.options = CmdParse::OptionParserWrapper.new do |opt|
    opt.separator "Global options:"
  end

  cmd.main_command.short_desc = 'Tool belt for managing your S3 buckets'
  cmd.main_command.description =<<END.strip
S3Sync provides a list of commands that will allow you to manage your content
stored in S3 buckets. To learn about each feature, please use the `help`
command:

$ #{File.basename $0} help sync"
END
  # Commands used more often
  cmd.add_command List.new
  cmd.add_command Delete.new
  cmd.add_command Url.new
  cmd.add_command Put.new
  cmd.add_command Get.new
  cmd.add_command Sync.new

  # Bucket related options
  cmd.add_command ListBuckets.new
  cmd.add_command CreateBucket.new
  cmd.add_command DeleteBucket.new

  # Built-in commands
  cmd.add_command CmdParse::HelpCommand.new
  cmd.add_command CmdParse::VersionCommand.new

  # Boom! Execute it
  cmd.parse
end