Module: SpotifyCli
- Defined in:
- lib/spotify_cli.rb,
lib/spotify_cli/api.rb,
lib/spotify_cli/app.rb,
lib/spotify_cli/version.rb
Defined Under Namespace
Constant Summary collapse
- VERSION =
"0.1.3"
Class Method Summary collapse
-
.call(args) ⇒ Object
CLI interface for the application Converts arguments to a mapped command and executes the command.
Class Method Details
.call(args) ⇒ Object
CLI interface for the application Converts arguments to a mapped command and executes the command
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 43 44 |
# File 'lib/spotify_cli.rb', line 11 def self.call(args) mappings = { 'next' => :next, 'n' => :next, 'previous' => :previous, 'pr' => :previous, 'set_pos' => :set_pos, 'pos' => :set_pos, 'replay' => :replay, 'rep' => :replay, 'restart' => :replay, 'pause' => :pause, 'stop' => :pause, 'play' => :play_pause, 'p' => :play_pause, 'play_pause' => :play_pause, 'status' => :status, 's' => :status, 'watch' => :watch, 'w' => :watch, 'help' => :help } if args.empty? SpotifyCli::Api.status else mapping = mappings[args.first] if mapping.nil? || mapping == :help SpotifyCli::Api.help(mappings) else SpotifyCli::Api.send(mapping) end end end |