@@ -30,10 +30,10 @@ import (
30
30
"github.com/spf13/cobra"
31
31
)
32
32
33
- var includeBuildDir bool
34
-
35
33
// initArchiveCommand creates a new `archive` command
36
34
func initArchiveCommand () * cobra.Command {
35
+ var includeBuildDir , overwrite bool
36
+
37
37
archiveCommand := & cobra.Command {
38
38
Use : fmt .Sprintf ("archive <%s> <%s>" , tr ("sketchPath" ), tr ("archivePath" )),
39
39
Short : tr ("Creates a zip file containing all sketch files." ),
@@ -45,15 +45,16 @@ func initArchiveCommand() *cobra.Command {
45
45
" " + os .Args [0 ] + " archive /home/user/Arduino/MySketch\n " +
46
46
" " + os .Args [0 ] + " archive /home/user/Arduino/MySketch /home/user/MySketchArchive.zip" ,
47
47
Args : cobra .MaximumNArgs (2 ),
48
- Run : runArchiveCommand ,
48
+ Run : func ( cmd * cobra. Command , args [] string ) { runArchiveCommand ( args , includeBuildDir , overwrite ) } ,
49
49
}
50
50
51
51
archiveCommand .Flags ().BoolVar (& includeBuildDir , "include-build-dir" , false , tr ("Includes %s directory in the archive." , "build" ))
52
+ archiveCommand .Flags ().BoolVarP (& overwrite , "overwrite" , "f" , false , tr ("Overwrites an already existing archive" ))
52
53
53
54
return archiveCommand
54
55
}
55
56
56
- func runArchiveCommand (cmd * cobra. Command , args []string ) {
57
+ func runArchiveCommand (args []string , includeBuildDir bool , overwrite bool ) {
57
58
logrus .Info ("Executing `arduino-cli sketch archive`" )
58
59
59
60
sketchPath := paths .New ("." )
@@ -73,6 +74,7 @@ func runArchiveCommand(cmd *cobra.Command, args []string) {
73
74
SketchPath : sketchPath .String (),
74
75
ArchivePath : archivePath ,
75
76
IncludeBuildDir : includeBuildDir ,
77
+ Overwrite : overwrite ,
76
78
})
77
79
78
80
if err != nil {
0 commit comments