Class: ResponseMate::Commands::List

Inherits:
Base
  • Object
show all
Defined in:
lib/response_mate/commands/list.rb

Overview

Command which performs the operations required by `response_mate list`

Instance Attribute Summary

Attributes inherited from Base

#args, #options

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from ResponseMate::Commands::Base

Instance Method Details

#runObject

Run the command based on args, options provided


4
5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/response_mate/commands/list.rb', line 4

def run
  environment = ResponseMate::Environment.new(options[:environment])
  @manifest = ResponseMate::Manifest.new(options[:requests_manifest], environment)

  available_keys = @manifest.requests.map { |r| r.key.to_sym }

  puts available_keys.join("\n") << "\n\n"

  action = ask_action
  return if action == :no

  perform_action(action, ask_key(available_keys))
end