@@ -37,9 +37,10 @@ import (
37
37
)
38
38
39
39
var (
40
- noDeps bool
41
- gitURL bool
42
- zipPath bool
40
+ noDeps bool
41
+ noOverwrite bool
42
+ gitURL bool
43
+ zipPath bool
43
44
)
44
45
45
46
func initInstallCommand () * cobra.Command {
@@ -59,6 +60,7 @@ func initInstallCommand() *cobra.Command {
59
60
},
60
61
}
61
62
installCommand .Flags ().BoolVar (& noDeps , "no-deps" , false , tr ("Do not install dependencies." ))
63
+ installCommand .Flags ().BoolVar (& noOverwrite , "no-overwrite" , false , tr ("Do not overwrite already installed libraries." ))
62
64
installCommand .Flags ().BoolVar (& gitURL , "git-url" , false , tr ("Enter git url for libraries hosted on repositories" ))
63
65
installCommand .Flags ().BoolVar (& zipPath , "zip-path" , false , tr ("Enter a path to zip file" ))
64
66
return installCommand
@@ -87,7 +89,7 @@ func runInstallCommand(cmd *cobra.Command, args []string) {
87
89
err := lib .ZipLibraryInstall (context .Background (), & rpc.ZipLibraryInstallRequest {
88
90
Instance : instance ,
89
91
Path : path ,
90
- Overwrite : true ,
92
+ Overwrite : ! noOverwrite ,
91
93
}, output .TaskProgress ())
92
94
if err != nil {
93
95
feedback .Errorf (tr ("Error installing Zip Library: %v" ), err )
@@ -110,7 +112,7 @@ func runInstallCommand(cmd *cobra.Command, args []string) {
110
112
err := lib .GitLibraryInstall (context .Background (), & rpc.GitLibraryInstallRequest {
111
113
Instance : instance ,
112
114
Url : url ,
113
- Overwrite : true ,
115
+ Overwrite : ! noOverwrite ,
114
116
}, output .TaskProgress ())
115
117
if err != nil {
116
118
feedback .Errorf (tr ("Error installing Git Library: %v" ), err )
@@ -128,10 +130,11 @@ func runInstallCommand(cmd *cobra.Command, args []string) {
128
130
129
131
for _ , libRef := range libRefs {
130
132
libraryInstallRequest := & rpc.LibraryInstallRequest {
131
- Instance : instance ,
132
- Name : libRef .Name ,
133
- Version : libRef .Version ,
134
- NoDeps : noDeps ,
133
+ Instance : instance ,
134
+ Name : libRef .Name ,
135
+ Version : libRef .Version ,
136
+ NoDeps : noDeps ,
137
+ NoOverwrite : noOverwrite ,
135
138
}
136
139
err := lib .LibraryInstall (context .Background (), libraryInstallRequest , output .ProgressBar (), output .TaskProgress ())
137
140
if err != nil {
0 commit comments