1
1
/*
2
- Copyright (c) 2019 VMware, Inc. All Rights Reserved.
2
+ Copyright (c) 2019-2024 VMware, Inc. All Rights Reserved.
3
3
4
4
Licensed under the Apache License, Version 2.0 (the "License");
5
5
you may not use this file except in compliance with the License.
6
6
You may obtain a copy of the License at
7
7
8
- http://www.apache.org/licenses/LICENSE-2.0
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
9
10
10
Unless required by applicable law or agreed to in writing, software
11
11
distributed under the License is distributed on an "AS IS" BASIS,
@@ -31,7 +31,8 @@ type sync struct {
31
31
* flags.FolderFlag
32
32
* flags.ResourcePoolFlag
33
33
34
- vmtx string
34
+ force bool
35
+ vmtx string
35
36
}
36
37
37
38
func init () {
@@ -45,6 +46,7 @@ func (cmd *sync) Register(ctx context.Context, f *flag.FlagSet) {
45
46
cmd .ResourcePoolFlag , ctx = flags .NewResourcePoolFlag (ctx )
46
47
cmd .ResourcePoolFlag .Register (ctx , f )
47
48
49
+ f .BoolVar (& cmd .force , "f" , false , "Forcefully synchronize file content" )
48
50
f .StringVar (& cmd .vmtx , "vmtx" , "" , "Sync subscribed library to local library as VM Templates" )
49
51
}
50
52
@@ -153,7 +155,7 @@ func (cmd *sync) Run(ctx context.Context, f *flag.FlagSet) error {
153
155
case library.Item :
154
156
lib := res .GetParent ().GetResult ().(library.Library )
155
157
if cmd .shouldSync (lib ) {
156
- if err = m .SyncLibraryItem (ctx , & t , false ); err != nil {
158
+ if err = m .SyncLibraryItem (ctx , & t , cmd . force ); err != nil {
157
159
return err
158
160
}
159
161
}
0 commit comments