summary refs log tree commit diff stats
Commit message (Expand)AuthorAgeFilesLines
...
* remove long-deprecated 'mapIt'narimiran2019-11-131-7/+0
* implemented alignas pragma (#12643)Arne Döring2019-11-1313-19/+153
* fixes #12644Andreas Rumpf2019-11-121-7/+10
* .cursor implementation (#12637)Andreas Rumpf2019-11-1212-36/+106
* Fix #12135 and #12109 (#12137)Euan2019-11-113-0/+570
* Version of trimZeros without temp strings (#12633)b3liever2019-11-112-13/+47
* --gc:destructors: bugfixesAraq2019-11-091-6/+6
* inhibit silly warning about moving closure environments for performanceAraq2019-11-091-1/+3
* --gc:destructors improvements (#12626)Andreas Rumpf2019-11-092-14/+18
* Implemented outplace differently (#12599)Clyybber2019-11-092-0/+50
* fix #12519: introduce OrderedTable.take, CountTable.del, CountTable.take (#12...Miran2019-11-082-5/+150
* fix compilation warning (#12618)cooldome2019-11-081-5/+5
* Fix crash in terminate handler (#12572) [backport]Volodymyr Lashko2019-11-071-0/+6
* make parsexml compatible with --gc:destructors/newruntimeAndreas Rumpf2019-11-071-2/+2
* added support for openArray's for `gcd` and `lcm` (#12621)Yanis Zafirópulos2019-11-071-1/+25
* fix #12597 (#12604)Arne Döring2019-11-072-4/+10
* allow random module to be used in standalone: (#12617)Judd2019-11-071-1/+1
* fixes #5050; fixes #11826 (#12606) [backport]cooldome2019-11-075-14/+47
* backtick and export marker handling in `eqIdent` (#12574)Arne Döring2019-11-074-12/+47
* added 'since' template for further stdlib additionsAndreas Rumpf2019-11-072-1/+5
* bugfix that enables the 'since' template [backport]Andreas Rumpf2019-11-071-2/+7
* pragmas.nim: tiny code formattingAndreas Rumpf2019-11-071-2/+1
* fix failing testnarimiran2019-11-071-1/+1
* osproc needs 'import linux' for -d:useCloneAndreas Rumpf2019-11-071-0/+3
* error message: Nim calls it 'proc'Andreas Rumpf2019-11-071-1/+1
* Merge pull request #12613 from nim-lang/miran-unused-importsDominik Picheta2019-11-0623-46/+22
|\
| * remove unused imports from testsnarimiran2019-11-0612-18/+10
| * remove unused importsnarimiran2019-11-0611-28/+12
* | restore --define:key:val in nim.cfg and fix #12367 (#12611)Andy Davidoff2019-11-061-0/+6
* | add --clearNimblePath; fixes #12601 (#12609)Andy Davidoff2019-11-063-0/+7
* | [backport] print more information for the previous commitnarimiran2019-11-061-0/+2
* | [backport] rewrite flaky runnable examplenarimiran2019-11-061-3/+5
* | [backport] doc/tut3.rst: Fix typo in Introduction (#12607) [ci skip]Tor Arvid Lund2019-11-061-1/+1
* | export nim.cfg parser (#12602)Andy Davidoff2019-11-061-1/+1
|/
* [backport] Add links to packaging and distro pages (#12603) [ci skip]Federico Ceratto2019-11-062-0/+4
* async: use $ and not repr in debug modeAraq2019-11-051-1/+1
* expr -> untypedAraq2019-11-051-1/+1
* Add `or detectOs(Manjaro)` (#12587) [backport]jiro2019-11-051-1/+1
* remove deprecated procs (#12535)Andreas Rumpf2019-11-0539-567/+111
* fix #8242, fix #12586: fix 'formatFloat' with 'precision = 0' (#12592)Miran2019-11-054-28/+39
* implement the --useVersion emulation featureAndreas Rumpf2019-11-041-1/+4
* Make sequtils.zip return seq of anonymous tuples (#12575)Kaushal Modi2019-11-043-42/+66
* Fixes #12379 (#12591) [backport]Clyybber2019-11-044-19/+21
* compiler/suggest: add variable support to `con` (#12569)alaviss2019-11-042-1/+21
* [backport] fix #12395 (#12590)Miran2019-11-041-3/+3
* fix conversions to uint in varints.nim (#12564)Arne Döring2019-11-041-22/+22
* --os:ios needs to imply defined(macosx) [backport] (#12585)Andreas Rumpf2019-11-041-1/+1
* NimPatch of devel version should be an odd number because of the earlier hacksnarimiran2019-11-031-1/+1
* newruntime: only check for dangling refs when 'owned ref T' support is enabledAndreas Rumpf2019-11-031-7/+8
* JS improve indent (#12581)Juan Carlos2019-11-032-2/+2
9307a6fa7e96641b822ed0a9acb75021dcf7fe9'>39307a6 ^
113de35 ^
acfe7d7 ^

2e5ae19 ^

76a9181 ^
2e5ae19 ^
caad1b2 ^
2e5ae19 ^



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
           


                
                 
              
 
                                    
 
                                           

                                               

 

                  
             


                        
                                


                                     
                                                                  
                                              

 
                                                              


                                                            
                                                      

                          
         









                                            



                               
         
                                             

                          
         
                                


                          
                                                              
                      
                                             
         
                    
                                    
                                                      
                                                         

                                          

                                          
                                                                                       
                                  
                                                               



                  
package msg

import (
	"errors"
	"strings"
	"time"

	"git.sr.ht/~sircmpwn/getopt"

	"git.sr.ht/~sircmpwn/aerc/commands"
	"git.sr.ht/~sircmpwn/aerc/widgets"
	"git.sr.ht/~sircmpwn/aerc/worker/types"
)

type Move struct{}

func init() {
	register(Move{})
}

func (Move) Aliases() []string {
	return []string{"mv", "move"}
}

func (Move) Complete(aerc *widgets.Aerc, args []string) []string {
	return commands.GetFolders(aerc, args)
}

func (Move) Execute(aerc *widgets.Aerc, args []string) error {
	if len(args) == 1 {
		return errors.New("Usage: mv [-p] <folder>")
	}
	opts, optind, err := getopt.Getopts(args, "p")
	if err != nil {
		return err
	}
	var (
		createParents bool
	)
	for _, opt := range opts {
		switch opt.Option {
		case 'p':
			createParents = true
		}
	}

	h := newHelper(aerc)
	store, err := h.store()
	if err != nil {
		return err
	}
	uids, err := h.markedOrSelectedUids()
	if err != nil {
		return err
	}
	acct, err := h.account()
	if err != nil {
		return err
	}
	_, isMsgView := h.msgProvider.(*widgets.MessageViewer)
	if isMsgView {
		aerc.RemoveTab(h.msgProvider)
	}
	store.Next()
	acct.Messages().Invalidate()
	joinedArgs := strings.Join(args[optind:], " ")
	store.Move(uids, joinedArgs, createParents, func(
		msg types.WorkerMessage) {

		switch msg := msg.(type) {
		case *types.Done:
			aerc.PushStatus("Message moved to "+joinedArgs, 10*time.Second)
		case *types.Error:
			aerc.PushError(" " + msg.Error.Error())
		}
	})
	return nil
}