Class: CassandraBackup::Command
- Inherits:
-
Object
- Object
- CassandraBackup::Command
- Defined in:
- lib/cassandra_backup/command.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #config ⇒ Object
-
#initialize(args) ⇒ Command
constructor
A new instance of Command.
Constructor Details
#initialize(args) ⇒ Command
Returns a new instance of Command.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/cassandra_backup/command.rb', line 7 def initialize(args) @options = {} if args.first [:keyspace] = args.first else args.push '-h' end OptionParser.new do |opts| opts. = "Usage: keyspace [options]" opts.on('-s', '--servers servers', 'Set server list. Default is 127.0.0.1:9160.') do |v| store_array_option :servers, v end opts.on('-c', '--tables tables', 'Set tables. Defaults to all') do |v| store_array_option :tables, v end opts.on('-v', '--version VERSION', 'Set cassandra version. Defaults to latest.') do |v| [:version] = v end opts.on('-w', '--where=\'where_conditions\'') do |v| [:where] = v end opts.on('--[no-]create-info', "Write out CREATE statements. Defaults to true.") do |v| [:create_info] = v end opts.on('--[no-]data', "Write out table data. Defaults to true.") do |v| [:data] = v end opts.on('-h', 'Show this help message.') do $stdout.puts opts; exit end opts.parse!(args) end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/cassandra_backup/command.rb', line 6 def @options end |
Instance Method Details
#config ⇒ Object
44 45 46 |
# File 'lib/cassandra_backup/command.rb', line 44 def config CassandraBackup::Config.new() end |