1
0
mirror of https://github.com/jhillyerd/inbucket.git synced 2025-12-17 09:37:02 +00:00

client: resolve linter errors (#431)

Signed-off-by: James Hillyerd <james@hillyerd.com>
This commit is contained in:
James Hillyerd
2023-11-13 11:11:08 -08:00
committed by GitHub
parent 7ae7d29741
commit 1ce1674861
4 changed files with 10 additions and 9 deletions

View File

@@ -9,9 +9,7 @@ import (
"github.com/inbucket/inbucket/v3/pkg/rest/client" "github.com/inbucket/inbucket/v3/pkg/rest/client"
) )
type listCmd struct { type listCmd struct{}
mailbox string
}
func (*listCmd) Name() string { func (*listCmd) Name() string {
return "list" return "list"
@@ -27,8 +25,7 @@ func (*listCmd) Usage() string {
` `
} }
func (l *listCmd) SetFlags(f *flag.FlagSet) { func (l *listCmd) SetFlags(f *flag.FlagSet) {}
}
func (l *listCmd) Execute( func (l *listCmd) Execute(
_ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus { _ context.Context, f *flag.FlagSet, _ ...interface{}) subcommands.ExitStatus {

View File

@@ -50,14 +50,17 @@ func main() {
// Important top-level flags // Important top-level flags
subcommands.ImportantFlag("host") subcommands.ImportantFlag("host")
subcommands.ImportantFlag("port") subcommands.ImportantFlag("port")
// Setup standard helpers // Setup standard helpers
subcommands.Register(subcommands.HelpCommand(), "") subcommands.Register(subcommands.HelpCommand(), "")
subcommands.Register(subcommands.FlagsCommand(), "") subcommands.Register(subcommands.FlagsCommand(), "")
subcommands.Register(subcommands.CommandsCommand(), "") subcommands.Register(subcommands.CommandsCommand(), "")
// Setup my commands // Setup my commands
subcommands.Register(&listCmd{}, "") subcommands.Register(&listCmd{}, "")
subcommands.Register(&matchCmd{}, "") subcommands.Register(&matchCmd{}, "")
subcommands.Register(&mboxCmd{}, "") subcommands.Register(&mboxCmd{}, "")
// Parse and execute // Parse and execute
flag.Parse() flag.Parse()
ctx := context.Background() ctx := context.Background()

View File

@@ -14,7 +14,6 @@ import (
) )
type matchCmd struct { type matchCmd struct {
mailbox string
output string output string
outFunc func(headers []*client.MessageHeader) error outFunc func(headers []*client.MessageHeader) error
delete bool delete bool

View File

@@ -11,8 +11,7 @@ import (
) )
type mboxCmd struct { type mboxCmd struct {
mailbox string delete bool
delete bool
} }
func (*mboxCmd) Name() string { func (*mboxCmd) Name() string {
@@ -73,9 +72,12 @@ func outputMbox(headers []*client.MessageHeader) error {
if err != nil { if err != nil {
return fmt.Errorf("Get source REST failed: %v", err) return fmt.Errorf("Get source REST failed: %v", err)
} }
fmt.Printf("From %s\n", h.From) fmt.Printf("From %s\n", h.From)
// TODO Escape "From " in message bodies with > // TODO Escape "From " in message bodies with >
source.WriteTo(os.Stdout) if _, err := source.WriteTo(os.Stdout); err != nil {
return err
}
fmt.Println() fmt.Println()
} }
return nil return nil