class AudioFeedManager::CommandsList

Public Instance Methods

get(argv) click to toggle source
# File lib/audio_feed_manager/cli/commands_list.rb, line 21
def get(argv)
  name, *options = *argv
  command = nil

  case name
  when 'init'
    command = initialize_project
  when 'publish'
    command = publish
  when 'help'
    command = help
  when 'feeds'
    subcommand, *options = *options
    name = "#{name} #{subcommand}"

    case subcommand
    when 'add'
      command = add_feed
    when 'show'
      command = show_feed
    when 'get-url'
      command = get_feed_url
    when 'update-rss'
      command = update_feed_rss
    when 'list'
      command = list_feeds
    end
  when 'audio'
    subcommand, *options = *options
    name = "#{name} #{subcommand}"

    case subcommand
    when 'add'
      command = add_audio_file
    end
  when nil
    command = help
  end

  raise UnknownCommand, "Unknown command: #{name}" unless command

  [command, options]
end
print_command_usage(command_name, subcommand_name = nil) click to toggle source
print_usage() click to toggle source
run(command_name: nil, subcommand_name: nil) click to toggle source
# File lib/audio_feed_manager/cli/commands_list.rb, line 99
def run(command_name: nil, subcommand_name: nil)
  if command_name
    print_command_usage(command_name, subcommand_name)
  else
    print_usage
  end
end

Private Instance Methods

command_list() click to toggle source
# File lib/audio_feed_manager/cli/commands_list.rb, line 113
def command_list
  [initialize_project, add_feed, list_feeds, show_feed, update_feed_rss, get_feed_url, add_audio_file, publish, help]
end
help() click to toggle source
# File lib/audio_feed_manager/cli/commands_list.rb, line 109
def help
  self
end