Module: Morpheus::Cli::PromptHelper

Defined in:
lib/morpheus/cli/mixins/prompt_helper.rb

Overview

Mixin for Morpheus::Cli command classes Provides common methods for prompting for input

Instance Method Summary collapse

Instance Method Details

#prompt_value(option_type, options, no_prompt = false, api_params = {}) ⇒ Object

Returns input value for the option type, usually a string or number if the value is an ID or of type: number.

Parameters:

  • options (Hash) —

    The context being constructed, checks this for the value before prompting the user for input.

  • no_prompt (Boolean) (defaults to: false) —

    The context being constructed, checks this for the value before prompting the user for input.

  • api_params (Hash) (defaults to: {}) —

    Optional map of parameters to include in API request for select option types

Returns:

  • input value for the option type, usually a string or number if the value is an ID or of type: number



11
12
13
14
# File 'lib/morpheus/cli/mixins/prompt_helper.rb', line 11

def prompt_value(option_type, options, no_prompt=false, api_params={})
  # this does not work with fieldContext, so get rid of it
  return Morpheus::Cli::OptionTypes.prompt([option_type.merge({'fieldContext' => nil})], options, @api_client, api_params, no_prompt)[option_type['fieldName']]
end