blob: 974fa807a23605db331ed02fe4bea91334ec21e6 (
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
34
35
36
37
38
39
40
41
42
43
|
#!/usr/bin/env ruby
# TODO
# - a lot of things
def usage
puts "Usage:
#{File.basename($0)} TODO! "
exit 1
end
# TODO: misc checks
def doDecrypt(someArguments)
filename = ARGV[2]
file = Keyringer::Fs.new()
content = file.get_as_string(filename)
crypt = Keyringer::Crypt.new(nil)
output = crypt.decrypt(content)
puts output
end
def doWrapper(someArguments)
exec("keyringer " + ARGV.join(' '))
end
$:.unshift File.dirname(__FILE__) + '/../lib'
require 'keyringer'
begin
keyring = ARGV[0]
action = ARGV[1]
if action == 'decrypt'
doDecrypt(ARGV)
else
doWrapper(ARGV)
end
rescue SystemExit => e
exit e.status
rescue Exception => e
puts "Fatal error: #{e.inspect}"
exit 1
end
|