Sha256: 0c22e9cd91d3130a8e347d67df8f9d1640987e38cbb711d68a86b7dc4847c25e
Contents?: true
Size: 952 Bytes
Versions: 8
Compression:
Stored size: 952 Bytes
Contents
require 'optparse' require 'keystorage' require 'keystorage/commands' module Keystorage class CLI def initialize(argv) @options = Hash.new @options[:file] = DEFAULT_FILE @argv = argv.clone @opt = OptionParser.new @opt.banner="Usage: keystorage [options] command [command options] args..." @opt.on('--help', 'show this message') { usage; exit } @opt.on('-f FILE','--file=FILE', 'file to store password') { |v| @options[:file] = v; } end def usage puts @opt; puts "Commands:" @commands = ["list","set","get","help"] @commands.each do |m| puts " "+m end end def execute argv = @opt.parse(@argv) command = argv.shift unless command usage;exit end Commands.send(command,argv,@options) end class << self def run(argv) self.new(argv).execute end end end end
Version data entries
8 entries across 8 versions & 1 rubygems