Class: S3Ranger::CLI::BaseCmd

Inherits:
CmdParse::Command
  • Object
show all
Defined in:
lib/s3ranger/cli.rb

Direct Known Subclasses

CreateBucket, Delete, DeleteBucket, Get, List, ListBuckets, Put, Sync, Url

Instance Method Summary collapse

Instance Method Details

#has_options?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'lib/s3ranger/cli.rb', line 43

def has_options?
  not options.instance_variables.empty?
end

#has_prefix?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/s3ranger/cli.rb', line 47

def has_prefix?
  @has_prefix
end

#usageObject



51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/s3ranger/cli.rb', line 51

def usage
  u = []
  u << "Usage: #{File.basename commandparser.program_name} #{name} "
  u << "[options] " if has_options?
  u << "bucket" if has_args?

  if has_prefix? == 'required'
    u << ':prefix'
  elsif has_prefix?
    u << "[:prefix]"
  end

  u.join ''
end