aboutsummaryrefslogtreecommitdiff
path: root/bin/keyringer
blob: d6ab3d487e1c3ec8c58919c3875242c783979f3c (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
32
33
#!/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 
  begin
    action = Keyringer.const_get(ARGV[1].capitalize)
  rescue NameError
    wrapper = Keyringer::BashWrapper.new
    wrapper.execute
  else
    if action.is_a?(Class)
      instance = action.new
      output   = instance.execute
      puts output
    end
  end
rescue SystemExit => e
  exit e.status
rescue Exception => e
  puts "Fatal error: #{e.inspect}"
  exit 1
end