Fix :move command's arg parsing

This commit is contained in:
Drew DeVault 2019-06-09 18:29:21 -04:00
parent 702ad43bd2
commit c55223106d

View file

@ -17,11 +17,11 @@ func init() {
} }
func Move(aerc *widgets.Aerc, args []string) error { func Move(aerc *widgets.Aerc, args []string) error {
opts, optind, err := getopt.Getopts(args[1:], "p") opts, optind, err := getopt.Getopts(args, "p")
if err != nil { if err != nil {
return err return err
} }
if optind != len(args)-2 { if optind != len(args)-1 {
return errors.New("Usage: mv [-p] <folder>") return errors.New("Usage: mv [-p] <folder>")
} }
var ( var (
@ -46,7 +46,7 @@ func Move(aerc *widgets.Aerc, args []string) error {
aerc.RemoveTab(widget) aerc.RemoveTab(widget)
} }
acct.Messages().Next() acct.Messages().Next()
store.Move([]uint32{msg.Uid}, args[optind+1], createParents, func( store.Move([]uint32{msg.Uid}, args[optind], createParents, func(
msg types.WorkerMessage) { msg types.WorkerMessage) {
switch msg := msg.(type) { switch msg := msg.(type) {