Class: Jets::CLI::Dotenv::List

Inherits:
Base
  • Object
show all
Defined in:
lib/jets/cli/dotenv/list.rb

Instance Attribute Summary

Attributes inherited from Base

#options

Instance Method Summary collapse

Methods inherited from Base

#initialize, #paginate, #paging_params, rescue_api_error

Methods included from Util::Logging

#log

Methods included from AwsServices

#apigateway, #aws_options, #cfn, #codebuild, #dynamodb, #lambda_client, #logs, #s3, #s3_resource, #sns, #sqs, #ssm, #sts, #wafv2

Methods included from AwsServices::StackStatus

#output_value, #stack_exists?

Methods included from AwsServices::GlobalMemoist

included, #reset_cache!

Methods included from Api

#api, #api_key

Constructor Details

This class inherits a constructor from Jets::CLI::Base

Instance Method Details

#inspect?(value) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/jets/cli/dotenv/list.rb', line 28

def inspect?(value)
  value.include?("\n") || Shellwords.escape(value) != value
end

#runObject



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/jets/cli/dotenv/list.rb', line 5

def run
  presenter = CliFormat::Presenter.new(@options)
  warn "# Env from config/jets/env files and SSM parameters"
  warn "# Values are not used locally. They are only used for the Lambda Function"
  unless @options[:reveal]
    warn "# To show values also, use the --reveal option"
  end
  presenter.empty_message = "# No env vars found"
  unless @options[:format] == "dotenv"
    header = ["Name"]
    header << "Value" if @options[:reveal]
    presenter.header = header
  end
  vars = Jets::Dotenv.parse
  vars.each do |key, value|
    v = inspect?(value) ? value.inspect : value
    row = [key]
    row << v if @options[:reveal]
    presenter.rows << row
  end
  presenter.show
end