diff --git a/cli/papero/info.go b/cli/papero/get.go similarity index 90% rename from cli/papero/info.go rename to cli/papero/get.go index f172d8e..09ea2c5 100644 --- a/cli/papero/info.go +++ b/cli/papero/get.go @@ -18,20 +18,20 @@ import ( const maxUInt32 = int(^uint32(0)) -var infoVerbs cli.CommandMap +var getVerbs cli.CommandMap func init() { - infoVerbs = cli.CommandMap{ - "list-mailboxes": LsMailboxCmd{}, - // "list-subscribed": LsSubscribedCmd{}, - "list-messages": LsMsgCmd{}, - "display-message": CatMsgCmd{}, + getVerbs = cli.CommandMap{ + "mailboxes": LsMailboxCmd{}, + "messages": LsMsgCmd{}, + "content": CatMsgCmd{}, + // "subscriptions": LsSubscribedCmd{}, } } -type InfoCmd struct{} +type GetCmd struct{} -func (i InfoCmd) Func(args []string) error { +func (i GetCmd) Func(args []string) error { flagset := flag.NewFlagSet(args[0], flag.ExitOnError) flagset.Usage = func() { i.Help(os.Stdout, flagset) } flagset.Parse(args[1:]) @@ -42,16 +42,16 @@ func (i InfoCmd) Func(args []string) error { } cmd := subArgs[0] if Session.Info.Opts.Debug { - Log.Debug("info verb:", cmd) + Log.Debug("get verbs:", cmd) } - return infoVerbs[cmd].Func(subArgs) + return getVerbs[cmd].Func(subArgs) } -func (i InfoCmd) Help(w io.Writer, set *flag.FlagSet) { - fmt.Fprintf(w, "USAGE: %s info VERB [verb opts]\n", Session.Info.Name) +func (i GetCmd) Help(w io.Writer, set *flag.FlagSet) { + fmt.Fprintf(w, "USAGE: %s get VERB [verb opts]\n", Session.Info.Name) fmt.Fprintf(w, "\nVERBS:\n") - for verb := range infoVerbs { + for verb := range getVerbs { fmt.Fprintf(w, "\t%s\n", verb) } } @@ -67,7 +67,7 @@ type mailboxInfo struct { func (l LsMailboxCmd) Func(args []string) error { if Session.Info.Opts.Debug { - Log.Debug("enter info list-mailboxes") + Log.Debug("enter get mailboxes") } var withAttributes bool var output string @@ -109,7 +109,7 @@ func (l LsMailboxCmd) Func(args []string) error { } func (l LsMailboxCmd) Help(w io.Writer, set *flag.FlagSet) { - fmt.Fprintf(w, "USAGE: %s info list-mailboxes [opts]\n", Session.Info.Name) + fmt.Fprintf(w, "USAGE: %s get mailboxes [opts]\n", Session.Info.Name) fmt.Fprintf(w, "\nOPTS:\n") set.PrintDefaults() } @@ -118,7 +118,7 @@ type LsMsgCmd struct{} func (l LsMsgCmd) Func(args []string) error { if Session.Info.Opts.Debug { - Log.Debug("enter info list-messages") + Log.Debug("enter get messages") } var limit uint var withSeq, withFrom, withDate, withFlags bool @@ -155,7 +155,7 @@ func (l LsMsgCmd) Func(args []string) error { } func (l LsMsgCmd) Help(w io.Writer, set *flag.FlagSet) { - fmt.Fprintf(w, "USAGE: %s info list-messages [opts] MAILBOX_NAME\n", Session.Info.Name) + fmt.Fprintf(w, "USAGE: %s get messages [opts] MAILBOX_NAME\n", Session.Info.Name) fmt.Fprintf(w, "\nOPTS:\n") set.PrintDefaults() } @@ -236,7 +236,7 @@ type CatMsgCmd struct{} func (c CatMsgCmd) Func(args []string) error { if Session.Info.Opts.Debug { - Log.Debug("enter info display-message") + Log.Debug("enter get content") } var idList []uint32 var withHeaders, withBody, withFlags, markRead bool @@ -294,7 +294,7 @@ func (c CatMsgCmd) Func(args []string) error { } func (c CatMsgCmd) Help(w io.Writer, set *flag.FlagSet) { - fmt.Fprintf(w, "USAGE: %s info display-message [opts] MAILBOX_NAME [MESSAGE_ID1 [MESSAGE_ID2 [...]]]\n", Session.Info.Name) + fmt.Fprintf(w, "USAGE: %s get content [opts] MAILBOX_NAME [MESSAGE_ID1 [MESSAGE_ID2 [...]]]\n", Session.Info.Name) fmt.Fprintf(w, "\nOPTS:\n") set.PrintDefaults() } diff --git a/cli/papero/main.go b/cli/papero/main.go index 4ea9cac..e4b64a8 100644 --- a/cli/papero/main.go +++ b/cli/papero/main.go @@ -16,11 +16,11 @@ var Session struct { var Log *log.Logger func init() { - info := InfoCmd{} + get := GetCmd{} set := SetCmd{} Session.Info.Commands = cli.CommandMap{ - "info": info, - "set": set, + "get": get, + "set": set, } Session.Info.Name = "papero" flag.Usage = func() { cli.Usage(os.Stdout, Session.Info) }