Sha256: bfa671b43799065a6da9c3a4307e432a7ec1dd2a79d88bbde65c0c14bf516452

Contents?: true

Size: 1.07 KB

Versions: 2

Compression:

Stored size: 1.07 KB

Contents

#!/usr/bin/env ruby

# frozen_string_literal: true

require 'encrypt_env'

argv = ARGV
action = argv.shift

if action == 'setup'
  EncryptEnv.setup
  exit 0
elsif action == 'show'
  if argv[0]
    EncryptEnv.show(argv[0])
  else
    EncryptEnv.show
  end
  exit 0
elsif action == 'all'
  EncryptEnv.show('all')
  exit 0
elsif action == 'edit'
  if argv[0]
    EncryptEnv.edit(argv[0])
  else
    EncryptEnv.edit
  end
  exit 0
elsif action == 'get'
  key = argv[0]
  env = argv[1]
  EncryptEnv.valueof(key, env)
  exit 0
elsif action == 'new'
  key = argv[0]
  env = argv[1]
  EncryptEnv.update_variable(key, env, true)
  exit 0
elsif action == 'update'
  key = argv[0]
  env = argv[1]
  EncryptEnv.update_variable(key, env, false)
  exit 0
elsif action == 'delete'
  key = argv[0]
  env = argv[1]
  EncryptEnv.delete_variable(key, env)
  exit 0
elsif ['help', '--help', '-h'].include?(action)
  puts <<~HELP
    Usage:
      encrypt_env setup
      encrypt_env secrets
      encrypt_env secrets_all
      encrypt_env edit
  HELP

  exit 0
else
  puts "Unknown action: #{action}"
  exit 1
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
encrypt_env-1.3.1 bin/encrypt_env
encrypt_env-1.3.0 bin/encrypt_env