Class: Twurl::AliasesController
- Inherits:
-
AbstractCommandController
- Object
- AbstractCommandController
- Twurl::AliasesController
- Defined in:
- lib/twurl/aliases_controller.rb
Constant Summary collapse
- NO_ALIASES_MESSAGE =
"No aliases exist. Set one this way: twurl alias h /1.1/statuses/home_timeline.json"
- NO_PATH_PROVIDED_MESSAGE =
"No path was provided to alias. Paths must start with a forward slash (ex. /1.1/statuses/update.json)."
Instance Attribute Summary
Attributes inherited from AbstractCommandController
Instance Method Summary collapse
Methods inherited from AbstractCommandController
Constructor Details
This class inherits a constructor from Twurl::AbstractCommandController
Instance Method Details
#dispatch ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/twurl/aliases_controller.rb', line 5 def dispatch case .subcommands.size when 0 aliases = OAuthClient.rcfile.aliases if aliases && !aliases.empty? aliases.keys.sort.each do |name| CLI.puts "#{name}: #{aliases[name]}" end else CLI.puts NO_ALIASES_MESSAGE end when 1 if .path OAuthClient.rcfile.alias(.subcommands.first, .path) else CLI.puts NO_PATH_PROVIDED_MESSAGE end end end |