Sha256: ae43a24fdbfd522daf25b601f93b050eb273f78abedbb3893175199f3f1ded9c

Contents?: true

Size: 883 Bytes

Versions: 21

Compression:

Stored size: 883 Bytes

Contents

#!/usr/bin/env ruby

lib_path = File.expand_path(File.dirname(__FILE__) + '/../lib')
$LOAD_PATH << lib_path if File.exist?(lib_path) && !$LOAD_PATH.include?(lib_path)

require 'sym'
require 'sym/app'
require 'sym/app/keychain'
require 'colored2'

def usage
  puts 'Usage: ' + 'keychain'.bold.blue + ' name [ add <contents> | find | delete ]'.bold.green
  exit 0
end

usage if ARGV.empty?

key_name, action, data = ARGV

unless %i(add find delete).include?(action.to_sym)
  puts "Error: operation #{action.bold.red} is not recognized"
  usage
end

if action.eql?('add') && data.nil?
  puts "Error: please provide data to store with the #{'add'.bold.green} operation."
  usage
end

begin
puts data ? \
  Sym::App::KeyChain.new(key_name).send(action.to_sym, data) :
  Sym::App::KeyChain.new(key_name).send(action.to_sym)
rescue StandardError => e
  STDERR.puts "#{e.message.red}"
end


Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
sym-2.8.5 exe/keychain
sym-2.8.4 exe/keychain
sym-2.8.2 exe/keychain
sym-2.8.1 exe/keychain
sym-2.8.0 exe/keychain
sym-2.7.0 exe/keychain
sym-2.6.3 exe/keychain
sym-2.6.2 exe/keychain
sym-2.6.1 exe/keychain
sym-2.6.0 exe/keychain
sym-2.5.3 exe/keychain
sym-2.5.1 exe/keychain
sym-2.5.0 exe/keychain
sym-2.4.3 exe/keychain
sym-2.3.0 exe/keychain
sym-2.2.1 exe/keychain
sym-2.2.0 exe/keychain
sym-2.1.2 exe/keychain
sym-2.1.1 exe/keychain
sym-2.1.0 exe/keychain