forked from ribice/glice
-
Notifications
You must be signed in to change notification settings - Fork 0
/
update.go
32 lines (27 loc) · 837 Bytes
/
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
package cmd
import (
"context"
"fmt"
"github.com/ribice/glice/v3/pkg"
"github.com/spf13/cobra"
)
// updateCmd represents the update command
var updateCmd = &cobra.Command{
Use: "update",
Run: RunUpdate,
Short: fmt.Sprintf("Update your project's `%s` file to include newly added dependencies", glice.ProjectFilename),
Long: fmt.Sprintf("Update your project's `%s` file to include newly added dependencies found when scanning go.mod.", glice.ProjectFilename),
}
func init() {
rootCmd.AddCommand(updateCmd)
}
//goland:noinspection GoUnusedParameter
func RunUpdate(cmd *cobra.Command, args []string) {
ctx := context.Background()
NoteBegin()
Notef("\nUpdating project file '%s'", glice.ProjectFilename)
deps := ScanDependencies(ctx)
pf := AuditingProjectDependencies(ctx, deps)
SaveProjectFile(ctx, pf)
NoteEnd()
}