Module: PolyglotIos::Helper::Terminal

Included in:
Command::Login, Command::Projects, Command::Pull, Command::Setup, ErrorHandler, General
Defined in:
lib/ios_polyglot_cli/helpers/terminal.rb

Instance Method Summary collapse

Instance Method Details

#generate_token_message(token_env_variable = nil) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/ios_polyglot_cli/helpers/terminal.rb', line 15

def generate_token_message(token_env_variable = nil)
  token_env_variable ||= PolyglotIos::DEFAULT_TOKEN_ENVIRONMENT_VARIABLE
  return <<~MESSAGE
    To generate an Auth Token, please visit Polyglot website ( for Infinum https://infinum.polyglothq.com ), generate a new token under Settings -> Security and store it in your environment variables under #{token_env_variable} variable.

    zsh:
        echo '\\nexport #{token_env_variable}=<YOUR_AUTH_TOKEN>' >> ~/.zshrc
        source ~/.zshrc
    bash:
        echo '\\nexport #{token_env_variable}=<YOUR_AUTH_TOKEN>' >> ~/.bashrc
        source ~/.bashrc
  MESSAGE
end

#promptObject



11
12
13
# File 'lib/ios_polyglot_cli/helpers/terminal.rb', line 11

def prompt
  @prompt ||= TTY::Prompt.new(interrupt: :exit)
end

#success(message = 'Success!') ⇒ Object



7
8
9
# File 'lib/ios_polyglot_cli/helpers/terminal.rb', line 7

def success(message = 'Success!')
  prompt.ok(message)
end