38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
# File 'lib/keybox/application/password_safe.rb', line 38
def option_parser
OptionParser.new do |op|
op.separator ""
op.separator "General Options:"
op.on("-f", "--file DATABASE_FILE", "The Database File to use") do |db_file|
@parsed_options.db_file = db_file
end
op.on("-c", "--config CONFIG_FILE", "The Configuration file to use") do |cfile|
@parsed_options.config_file = cfile
end
op.on("--color SCHEME","The color scheme to use", "none,dark_bg,light_bg,<other>") do |scheme|
@parsed_options.color_scheme = scheme.to_sym
end
op.on("-D", "--debug", "Ouput debug information to STDERR") do
@parsed_options.debug = true
end
op.on("--[no-]use-hash-for-url", "Use the password hash algorithm ", " for URL accounts") do |r|
@parsed_options.use_password_hash_for_url = r
end
op.separator ""
op.separator "Commands, one and only one of these is required:"
op.on("-h", "--help") do
@parsed_options.show_help = true
end
op.on("-a", "--add ACCOUNT", "Create a new account in keybox") do |account|
@actions << [:add, account]
end
op.on("-d", "--delete ACCOUNT", "Delete the account from keybox") do |account|
@actions << [:delete, account]
end
op.on("-e", "--edit ACCOUNT", "Edit the account in keybox") do |account|
@actions << [:edit, account]
end
op.on("-l", "--list [REGEX]", "List the matching accounts", " (no argument will list all)") do |regex|
regex = regex || ".*"
@actions << [:list, regex]
end
op.on("-m", "--master-password", "Change the master password") do
@actions << [:master_password, nil]
end
op.on("-s", "--show [REGEX]", "Show the given account(s)") do |regex|
regex = regex || ".*"
@actions << [:show, regex]
end
op.on("-v", "--version", "Show version information") do
@parsed_options.show_version = true
end
op.separator ""
op.separator "Import / Export from other data formats:"
op.on("-i", "--import-from-csv FILE", "Import from a CSV file") do |file|
@actions << [:import_from_csv, file]
end
op.on("-x", "--export-to-csv FILE", "Export contents to a CSV file") do |file|
@actions << [:export_to_csv, file]
end
end
end
|