Skip to content
Permalink
Browse files

Improve help commands, add help <command>

  • Loading branch information...
Raggaer committed Feb 20, 2019
1 parent e1ba511 commit 5cb0fd1ef4abab4094ff82e29cac583febff3e90
Showing with 14 additions and 1 deletion.
  1. +10 −0 command.go
  2. +1 −1 entry.go
  3. +3 −0 main.go
@@ -123,10 +123,20 @@ func exit(args []string) {

// Command "help" shows the list of commands
func help(args []string) {
// Check if we want help about a command
if len(args) > 1 {
for _, command := range commands {
if command.Key == args[1] {
fmt.Println(command.Key + " -- " + command.Help)
}
}
return
}
for _, command := range commands {
if command.Help == "" && command.HelpSmall == "" {
continue
}
fmt.Println(command.Key + " -- " + command.HelpSmall)
}
fmt.Println("\r\nType \"help <command>\" for a more detailed help on a command")
}
@@ -59,7 +59,7 @@ func show(args []string) {
fmt.Println("Password: " + mask(entry.GetPassword(), "*"))
fmt.Println("URL: " + entry.GetContent("URL"))
fmt.Println("Notes:")
if len(notes) > 0 {
if len(entry.GetContent("notes")) > 0 {
fmt.Println(entry.GetContent("Notes"))
}
}
@@ -24,6 +24,9 @@ var (
)

func main() {
fmt.Println("gokpcli is ready for operation")
fmt.Println("Type 'help' for a description of available commands")
fmt.Println("Type 'help <command>' for details on individual commands")
fmt.Print(waitCommandMessage)

// Parse application flags

0 comments on commit 5cb0fd1

Please sign in to comment.
You can’t perform that action at this time.