Sha256: 8042697b407bd4302b8881001b025ca0eeb53414a90d2ec880f997f5fcdcd23b
Contents?: true
Size: 737 Bytes
Versions: 6
Compression:
Stored size: 737 Bytes
Contents
module ServicePrompter def service_id(allow_none=false) return options[:service_id] if options[:service_id] return options[:service_id] = ENV['SERVICE_ID'] if ENV['SERVICE_ID'] return options[:service_id] = prompt_for_service_id(allow_none) end private def prompt_for_service_id(allow_none) result = get("services/services") (puts "No services have been defined. Cannot continue"; exit 1) if result.empty? # Build a menu of the services puts return prompter.choose do | menu | menu.prompt = "Select the Service: " menu.choice("No Selection") { -1 } if allow_none result.each do | service | menu.choice(service['name']) { service['id'] } end end end end
Version data entries
6 entries across 6 versions & 1 rubygems