lint: apply new formatting rules
Run `make fmt`. Signed-off-by: Moritz Poldrack <git@moritz.sh> Acked-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
parent
21dcd440f8
commit
aaf0a0c656
78 changed files with 288 additions and 285 deletions
|
@ -4,9 +4,7 @@ import (
|
|||
"git.sr.ht/~rjarry/aerc/commands"
|
||||
)
|
||||
|
||||
var (
|
||||
AccountCommands *commands.Commands
|
||||
)
|
||||
var AccountCommands *commands.Commands
|
||||
|
||||
func register(cmd commands.Command) {
|
||||
if AccountCommands == nil {
|
||||
|
|
|
@ -9,9 +9,7 @@ import (
|
|||
"git.sr.ht/~rjarry/aerc/widgets"
|
||||
)
|
||||
|
||||
var (
|
||||
history map[string]string
|
||||
)
|
||||
var history map[string]string
|
||||
|
||||
type ChangeFolder struct{}
|
||||
|
||||
|
|
|
@ -9,9 +9,7 @@ import (
|
|||
"github.com/mitchellh/go-homedir"
|
||||
)
|
||||
|
||||
var (
|
||||
previousDir string
|
||||
)
|
||||
var previousDir string
|
||||
|
||||
type ChangeDirectory struct{}
|
||||
|
||||
|
|
|
@ -4,9 +4,7 @@ import (
|
|||
"git.sr.ht/~rjarry/aerc/commands"
|
||||
)
|
||||
|
||||
var (
|
||||
ComposeCommands *commands.Commands
|
||||
)
|
||||
var ComposeCommands *commands.Commands
|
||||
|
||||
func register(cmd commands.Command) {
|
||||
if ComposeCommands == nil {
|
||||
|
|
|
@ -12,17 +12,15 @@ import (
|
|||
|
||||
type Header struct{}
|
||||
|
||||
var (
|
||||
headers = []string{
|
||||
"From",
|
||||
"To",
|
||||
"Cc",
|
||||
"Bcc",
|
||||
"Subject",
|
||||
"Comments",
|
||||
"Keywords",
|
||||
}
|
||||
)
|
||||
var headers = []string{
|
||||
"From",
|
||||
"To",
|
||||
"Cc",
|
||||
"Bcc",
|
||||
"Subject",
|
||||
"Comments",
|
||||
"Keywords",
|
||||
}
|
||||
|
||||
func init() {
|
||||
register(Header{})
|
||||
|
@ -50,9 +48,7 @@ func (Header) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
return errors.New("command parsing failed")
|
||||
}
|
||||
|
||||
var (
|
||||
force bool = false
|
||||
)
|
||||
var force bool = false
|
||||
for _, opt := range opts {
|
||||
switch opt.Option {
|
||||
case 'f':
|
||||
|
|
|
@ -111,7 +111,7 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
var copyBuf bytes.Buffer // for the Sent folder content if CopyTo is set
|
||||
|
||||
failCh := make(chan error)
|
||||
//writer
|
||||
// writer
|
||||
go func() {
|
||||
defer logging.PanicHandler()
|
||||
|
||||
|
@ -144,7 +144,7 @@ func (Send) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
failCh <- sender.Close()
|
||||
}()
|
||||
|
||||
//cleanup + copy to sent
|
||||
// cleanup + copy to sent
|
||||
go func() {
|
||||
defer logging.PanicHandler()
|
||||
|
||||
|
@ -431,7 +431,8 @@ func connectSmtps(host string) (*smtp.Client, error) {
|
|||
}
|
||||
|
||||
func copyToSent(worker *types.Worker, dest string,
|
||||
n int, msg io.Reader) <-chan error {
|
||||
n int, msg io.Reader,
|
||||
) <-chan error {
|
||||
errCh := make(chan error)
|
||||
worker.PostAction(&types.AppendMessage{
|
||||
Destination: dest,
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
package commands
|
||||
|
||||
var (
|
||||
GlobalCommands *Commands
|
||||
)
|
||||
var GlobalCommands *Commands
|
||||
|
||||
func register(cmd Command) {
|
||||
if GlobalCommands == nil {
|
||||
|
|
|
@ -86,7 +86,8 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
|
||||
for dir, uids := range uidMap {
|
||||
store.Move(uids, dir, true, func(
|
||||
msg types.WorkerMessage) {
|
||||
msg types.WorkerMessage,
|
||||
) {
|
||||
switch msg := msg.(type) {
|
||||
case *types.Done:
|
||||
wg.Done()
|
||||
|
@ -111,7 +112,8 @@ func (Archive) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
}
|
||||
|
||||
func groupBy(msgs []*models.MessageInfo,
|
||||
grouper func(*models.MessageInfo) string) map[string][]uint32 {
|
||||
grouper func(*models.MessageInfo) string,
|
||||
) map[string][]uint32 {
|
||||
m := make(map[string][]uint32)
|
||||
for _, msg := range msgs {
|
||||
group := grouper(msg)
|
||||
|
|
|
@ -34,9 +34,7 @@ func (Copy) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var (
|
||||
createParents bool
|
||||
)
|
||||
var createParents bool
|
||||
for _, opt := range opts {
|
||||
switch opt.Option {
|
||||
case 'p':
|
||||
|
@ -54,8 +52,8 @@ func (Copy) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
}
|
||||
store.Copy(uids, strings.Join(args[optind:], " "),
|
||||
createParents, func(
|
||||
msg types.WorkerMessage) {
|
||||
|
||||
msg types.WorkerMessage,
|
||||
) {
|
||||
switch msg := msg.(type) {
|
||||
case *types.Done:
|
||||
aerc.PushStatus("Messages copied.", 10*time.Second)
|
||||
|
|
|
@ -42,7 +42,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
//caution, can be nil
|
||||
// caution, can be nil
|
||||
next := findNextNonDeleted(uids, store)
|
||||
store.ClearVisualMark()
|
||||
store.Delete(uids, func(msg types.WorkerMessage) {
|
||||
|
|
|
@ -28,7 +28,6 @@ func (invite) Complete(aerc *widgets.Aerc, args []string) []string {
|
|||
}
|
||||
|
||||
func (invite) Execute(aerc *widgets.Aerc, args []string) error {
|
||||
|
||||
acct := aerc.SelectedAccount()
|
||||
if acct == nil {
|
||||
return errors.New("no account selected")
|
||||
|
@ -90,9 +89,7 @@ func (invite) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
}
|
||||
}
|
||||
|
||||
var (
|
||||
to []*mail.Address
|
||||
)
|
||||
var to []*mail.Address
|
||||
|
||||
if len(msg.Envelope.ReplyTo) != 0 {
|
||||
to = msg.Envelope.ReplyTo
|
||||
|
|
|
@ -52,8 +52,8 @@ func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
}
|
||||
}
|
||||
store.ModifyLabels(uids, add, remove, func(
|
||||
msg types.WorkerMessage) {
|
||||
|
||||
msg types.WorkerMessage,
|
||||
) {
|
||||
switch msg := msg.(type) {
|
||||
case *types.Done:
|
||||
aerc.PushStatus("labels updated", 10*time.Second)
|
||||
|
|
|
@ -34,9 +34,7 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var (
|
||||
createParents bool
|
||||
)
|
||||
var createParents bool
|
||||
for _, opt := range opts {
|
||||
switch opt.Option {
|
||||
case 'p':
|
||||
|
@ -61,8 +59,8 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
findNextNonDeleted(uids, store)
|
||||
joinedArgs := strings.Join(args[optind:], " ")
|
||||
store.Move(uids, joinedArgs, createParents, func(
|
||||
msg types.WorkerMessage) {
|
||||
|
||||
msg types.WorkerMessage,
|
||||
) {
|
||||
switch msg := msg.(type) {
|
||||
case *types.Done:
|
||||
aerc.PushStatus("Message moved to "+joinedArgs, 10*time.Second)
|
||||
|
|
|
@ -4,9 +4,7 @@ import (
|
|||
"git.sr.ht/~rjarry/aerc/commands"
|
||||
)
|
||||
|
||||
var (
|
||||
MessageCommands *commands.Commands
|
||||
)
|
||||
var MessageCommands *commands.Commands
|
||||
|
||||
func register(cmd commands.Command) {
|
||||
if MessageCommands == nil {
|
||||
|
|
|
@ -36,7 +36,6 @@ func (FlagMsg) Complete(aerc *widgets.Aerc, args []string) []string {
|
|||
// If this was called as 'read' or 'unread', it has the same effect as
|
||||
// 'flag' or 'unflag', respectively, but the 'Seen' flag is affected.
|
||||
func (FlagMsg) Execute(aerc *widgets.Aerc, args []string) error {
|
||||
|
||||
// The flag to change
|
||||
var flag models.Flag
|
||||
// User-readable name of the flag to change
|
||||
|
@ -184,7 +183,8 @@ func (FlagMsg) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
|
||||
func submitFlagChange(aerc *widgets.Aerc, store *lib.MessageStore,
|
||||
uids []uint32, flag models.Flag, newState bool,
|
||||
wg *sync.WaitGroup, success *bool) {
|
||||
wg *sync.WaitGroup, success *bool,
|
||||
) {
|
||||
store.Flag(uids, flag, newState, func(msg types.WorkerMessage) {
|
||||
wg.Add(1)
|
||||
switch msg := msg.(type) {
|
||||
|
|
|
@ -136,7 +136,6 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
)
|
||||
aerc.AddDialog(confirm)
|
||||
}
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -212,9 +211,7 @@ func (Recall) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
mu.Unlock()
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
return nil
|
||||
|
|
|
@ -146,7 +146,7 @@ func (reply) Execute(aerc *widgets.Aerc, args []string) error {
|
|||
to = append(to, envTos...)
|
||||
|
||||
for _, addr := range msg.Envelope.Cc {
|
||||
//dedupe stuff from the to/from headers
|
||||
// dedupe stuff from the to/from headers
|
||||
if recSet.Contains(addr) {
|
||||
continue
|
||||
}
|
||||
|
@ -259,8 +259,8 @@ func (s addrSet) Contains(a *mail.Address) bool {
|
|||
return ok
|
||||
}
|
||||
|
||||
//setReferencesHeader adds the references header to target based on parent
|
||||
//according to RFC2822
|
||||
// setReferencesHeader adds the references header to target based on parent
|
||||
// according to RFC2822
|
||||
func setReferencesHeader(target, parent *mail.Header) error {
|
||||
refs, err := parent.MsgIDList("references")
|
||||
if err != nil {
|
||||
|
@ -285,7 +285,8 @@ func setReferencesHeader(target, parent *mail.Header) error {
|
|||
|
||||
// addMimeType adds the proper mime type of the part to the originalMail struct
|
||||
func addMimeType(msg *models.MessageInfo, part []int,
|
||||
orig *models.OriginalMail) error {
|
||||
orig *models.OriginalMail,
|
||||
) error {
|
||||
// caution, :forward uses the code as well, keep that in mind when modifying
|
||||
bs, err := msg.BodyStructure.PartAtIndex(part)
|
||||
if err != nil {
|
||||
|
|
|
@ -18,10 +18,12 @@ func TestParseUnsubscribe(t *testing.T) {
|
|||
{"<https://example.com> is a URL", []string{
|
||||
"https://example.com",
|
||||
}},
|
||||
{"<mailto:user@host?subject=unsubscribe>, <https://example.com>",
|
||||
{
|
||||
"<mailto:user@host?subject=unsubscribe>, <https://example.com>",
|
||||
[]string{
|
||||
"mailto:user@host?subject=unsubscribe", "https://example.com",
|
||||
}},
|
||||
},
|
||||
},
|
||||
{"<>, <https://example> ", []string{
|
||||
"", "https://example",
|
||||
}},
|
||||
|
|
|
@ -4,9 +4,7 @@ import (
|
|||
"git.sr.ht/~rjarry/aerc/commands"
|
||||
)
|
||||
|
||||
var (
|
||||
MessageViewCommands *commands.Commands
|
||||
)
|
||||
var MessageViewCommands *commands.Commands
|
||||
|
||||
func register(cmd commands.Command) {
|
||||
if MessageViewCommands == nil {
|
||||
|
|
|
@ -129,7 +129,6 @@ func savePart(
|
|||
aerc *widgets.Aerc,
|
||||
params *saveParams,
|
||||
) error {
|
||||
|
||||
if params.trailingSlash || isDirExists(path) {
|
||||
filename := generateFilename(pi.Part)
|
||||
path = filepath.Join(path, filename)
|
||||
|
@ -137,7 +136,7 @@ func savePart(
|
|||
|
||||
dir := filepath.Dir(path)
|
||||
if params.createDirs && dir != "" {
|
||||
err := os.MkdirAll(dir, 0755)
|
||||
err := os.MkdirAll(dir, 0o755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -177,7 +176,7 @@ func savePart(
|
|||
return nil
|
||||
}
|
||||
|
||||
//isDir returns true if path is a directory and exists
|
||||
// isDir returns true if path is a directory and exists
|
||||
func isDirExists(path string) bool {
|
||||
pathinfo, err := os.Stat(path)
|
||||
if err != nil {
|
||||
|
@ -189,14 +188,14 @@ func isDirExists(path string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
//pathExists returns true if path exists
|
||||
// pathExists returns true if path exists
|
||||
func pathExists(path string) bool {
|
||||
_, err := os.Stat(path)
|
||||
|
||||
return err == nil
|
||||
}
|
||||
|
||||
//isAbsPath returns true if path given is anchored to / or . or ~
|
||||
// isAbsPath returns true if path given is anchored to / or . or ~
|
||||
func isAbsPath(path string) bool {
|
||||
if len(path) == 0 {
|
||||
return false
|
||||
|
|
|
@ -2,8 +2,9 @@ package commands
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"git.sr.ht/~rjarry/aerc/widgets"
|
||||
"strings"
|
||||
|
||||
"git.sr.ht/~rjarry/aerc/widgets"
|
||||
)
|
||||
|
||||
type Prompt struct{}
|
||||
|
|
|
@ -21,7 +21,6 @@ func init() {
|
|||
|
||||
func (Set) Aliases() []string {
|
||||
return []string{"set"}
|
||||
|
||||
}
|
||||
|
||||
func (Set) Complete(aerc *widgets.Aerc, args []string) []string {
|
||||
|
@ -48,7 +47,6 @@ func SetCore(aerc *widgets.Aerc, args []string) error {
|
|||
new_file := ini.Empty()
|
||||
|
||||
section, err := new_file.NewSection(category)
|
||||
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -4,9 +4,7 @@ import (
|
|||
"git.sr.ht/~rjarry/aerc/commands"
|
||||
)
|
||||
|
||||
var (
|
||||
TerminalCommands *commands.Commands
|
||||
)
|
||||
var TerminalCommands *commands.Commands
|
||||
|
||||
func register(cmd commands.Command) {
|
||||
if TerminalCommands == nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue