Module: EasyCreds::Actions::Status

Defined in:
lib/easy_creds/actions/status.rb

Class Method Summary collapse

Class Method Details

.call(ctx) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/easy_creds/actions/status.rb', line 8

def self.call(ctx)
  env = ctx.env
  Theme.section("Status — #{env}")

  local_enc = ctx.io.enc_exists?(env)
  local_key = ctx.io.key_exists?(env)

  spinner = TTY::Spinner.new('[:spinner] Checking 1Password...', format: :dots)
  spinner.auto_spin
  remote_fields = ctx.op.item(env)
  key_stored    = ctx.op.read_credentials_key(env, ctx.config.credentials_item)
  spinner.stop('')

  puts ''
  print_local_status(env, local_enc, local_key)
  print_remote_status(ctx, env, remote_fields, key_stored)
  print_drift(ctx, env, local_enc, local_key, remote_fields)
  print_overlay_status(ctx, env)
end