-
Notifications
You must be signed in to change notification settings - Fork 13
/
update.go
46 lines (36 loc) · 1.31 KB
/
update.go
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
// Copyright (c) 2016, Ben Morgan. All rights reserved.
// Use of this source code is governed by an MIT license
// that can be found in the LICENSE file.
package main
import "github.com/spf13/cobra"
var (
updateRequireSignature bool
)
func init() {
MainCmd.AddCommand(updateCmd)
updateCmd.Flags().BoolVarP(&updateRequireSignature, "require-signature", "r", false, "require package signatures")
}
var updateCmd = &cobra.Command{
Use: "update [pkgname...]",
Short: "Update database in repository",
Long: `Update database by adding packages and dispatching obsolete files.
Package files that are newer than the registered versions in the
database are added to the database; entries in the database which
have no files are removed.
If no package names are given, the entire repository is scanned for
updates.
If backup is true, obsolete files are backup up instead of deleted.
If the backup directory resolves to the repository directory,
then obsolete package files are ignored.
`,
Example: ` repoctl update fairsplit`,
ValidArgsFunction: completeRepoPackageNames,
PreRunE: ProfileInit,
PostRunE: ProfileTeardown,
RunE: func(cmd *cobra.Command, args []string) error {
if updateRequireSignature {
Repo.RequireSignature = true
}
return Repo.Update(nil, args...)
},
}