Skip to content

Commit 3597fb6

Browse files
author
Anand
committed
ref issue #8 - option to generate password -g
1 parent 96772b5 commit 3597fb6

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

options.go

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,10 @@ OPTIONS
3131
3232
FIND/LIST ACTIONS:
3333
34+
%s
35+
36+
MISC ACTIONS:
37+
3438
%s
3539
3640
HELP ACTIONS:
@@ -53,6 +57,7 @@ func usageString(optMap map[string]interface{}) {
5357
var findActions []string
5458
var helpActions []string
5559
var flagActions []string
60+
var miscActions []string
5661

5762
var maxLen1 int
5863
var maxLen2 int
@@ -95,12 +100,18 @@ func usageString(optMap map[string]interface{}) {
95100
helpActions = append(helpActions, fmt.Sprintf(usageTemplate, "-"+string(option.Short), option.Long, option.Path, option.Help))
96101
case 3:
97102
flagActions = append(flagActions, fmt.Sprintf(usageTemplate, "-"+string(option.Short), option.Long, option.Path, option.Help))
103+
case 4:
104+
miscActions = append(miscActions, fmt.Sprintf(usageTemplate, "-"+string(option.Short), option.Long, option.Path, option.Help))
98105
}
99106
}
100107

101-
fmt.Println(fmt.Sprintf(HELP_STRING, APP, strings.Join(editActions, "\n"),
102-
strings.Join(findActions, "\n"), strings.Join(helpActions, "\n"),
103-
strings.Join(flagActions, "\n"), AUTHOR_EMAIL))
108+
fmt.Println(fmt.Sprintf(HELP_STRING, APP,
109+
strings.Join(editActions, "\n"),
110+
strings.Join(findActions, "\n"),
111+
strings.Join(miscActions, "\n"),
112+
strings.Join(helpActions, "\n"),
113+
strings.Join(flagActions, "\n"),
114+
AUTHOR_EMAIL))
104115

105116
}
106117

@@ -122,6 +133,7 @@ func initializeCommandLine() (map[string]interface{}, map[string]interface{}) {
122133
{'E', "edit", "<id>", "Edit entry by id", 0},
123134
{'l', "list-entry", "<id>", "List entry by id", 1},
124135
{'x', "export", "<filename>", "Export all entries to <filename>", 1},
136+
{'g', "genpass", "<length>", "Generate password of given length", 4},
125137
}
126138

127139
for _, opt := range stringOptions {

0 commit comments

Comments
 (0)