Module: SecretsCli::Helpers
- Included in:
- Check::Secrets, Check::Vault, Init, Prompts::SecretsFile, Prompts::SecretsStorageKey, Prompts::VaultAddr, Vault::Auth, Vault::Base
- Defined in:
- lib/secrets_cli/helpers.rb
Instance Method Summary collapse
- #config ⇒ Object
- #error(message) ⇒ Object
- #error!(message) ⇒ Object
- #pastel ⇒ Object
- #pretty_diff(diff) ⇒ Object
- #print_verbose(message) ⇒ Object
- #prompt ⇒ Object
Instance Method Details
#config ⇒ Object
11 12 13 |
# File 'lib/secrets_cli/helpers.rb', line 11 def config @config ||= SecretsCli::Configuration.new() end |
#error(message) ⇒ Object
20 21 22 23 |
# File 'lib/secrets_cli/helpers.rb', line 20 def error() prompt.error() exit 0 end |
#error!(message) ⇒ Object
15 16 17 18 |
# File 'lib/secrets_cli/helpers.rb', line 15 def error!() prompt.error() exit 1 end |
#pastel ⇒ Object
7 8 9 |
# File 'lib/secrets_cli/helpers.rb', line 7 def pastel @pastel ||= Pastel.new end |
#pretty_diff(diff) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/secrets_cli/helpers.rb', line 29 def pretty_diff(diff) diff.each_line do |line| case line[0] when '+' then prompt.ok(line, newline: false) when '-' then prompt.error(line, newline: false) else puts line end end puts end |
#print_verbose(message) ⇒ Object
25 26 27 |
# File 'lib/secrets_cli/helpers.rb', line 25 def print_verbose() puts pastel.cyan() end |
#prompt ⇒ Object
3 4 5 |
# File 'lib/secrets_cli/helpers.rb', line 3 def prompt @prompt ||= TTY::Prompt.new end |