aboutsummaryrefslogtreecommitdiff
path: root/bin/keyringer
blob: 74dfcb1154d81eb703391c61825b323ca3660e08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env ruby

# TODO
# - a lot of things

def usage
  puts "Usage:
#{File.basename($0)} TODO! "
  exit 1
end

$:.unshift File.dirname(__FILE__) + '/../lib'
require 'keyringer'
begin 
  action = Keyringer.const_get(ARGV[1].capitalize)

  if action.is_a?(Class)
    instance = action.new
    output   = instance.execute
    puts output
  end
rescue NameError
  wrapper = Keyringer::BashWrapper.new
  wrapper.execute
rescue SystemExit => e
  exit e.status
rescue Exception => e
  puts "Fatal error: #{e.inspect}"
  exit 1
end