Class: KmsTools::CLI::Helpers
- Inherits:
-
Object
- Object
- KmsTools::CLI::Helpers
- Defined in:
- lib/kms-tools/cli/helpers.rb
Overview
General purpose helper functions for the CLI
Class Method Summary collapse
-
.get_save_path(params) ⇒ String
Prompts the user for a path to save a file.
-
.select_key(kms) ⇒ String
Prompts the user to select a key alias from a list of key aliases available to current credentials.
Class Method Details
.get_save_path(params) ⇒ String
Prompts the user for a path to save a file. Optionally providers a default suggestion.
20 21 22 23 24 25 26 |
# File 'lib/kms-tools/cli/helpers.rb', line 20 def self.get_save_path(params) prompt = params[:prompt].nil? ? "Save to" : params[:prompt] prompt << " (#{params[:suggested_path]})" if params[:suggested_path] prompt << ": " entered_path = KmsTools::CLI::Output.ask(prompt, String) entered_path.empty? ? params[:suggested_path] : entered_path end |
.select_key(kms) ⇒ String
Prompts the user to select a key alias from a list of key aliases available to current credentials
10 11 12 |
# File 'lib/kms-tools/cli/helpers.rb', line 10 def self.select_key(kms) Output.select_from_list("Choose which key alias to use as the base Customer Master Key:", kms.available_aliases) end |