Class: Twat::Subcommands::Set

Inherits:
Base
  • Object
show all
Defined in:
lib/twat/subcommands/set.rb

Instance Attribute Summary

Attributes inherited from Base

#opts

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#args, #auth!, #beep, #config, #deentitize, #enable_readline!, #format, #initialize, #needs_arguments, #needs_at_least, #pad, #reader, #run!, #usage, #usage_and_exit!

Methods included from Exceptions

#with_handled_exceptions

Constructor Details

This class inherits a constructor from Twat::Subcommands::Base

Class Method Details

.usageObject



12
13
14
15
# File 'lib/twat/subcommands/set.rb', line 12

def self.usage
  "Usage: twat set option value"
  # TODO Dump available options
end

Instance Method Details

#runObject



4
5
6
7
8
9
10
# File 'lib/twat/subcommands/set.rb', line 4

def run
  needs_arguments(2)
  k, v = @argv[0..1]
  opts.send(:"#{k}=", v)

  puts "Successfully set #{k} as #{v}"
end