rename --scan-vulns to --vulns, add subcommand aliases, make check updates-only by default

This commit is contained in:
CarterPerez-dev 2026-01-27 23:46:34 -05:00
parent d9445e06b5
commit 58d63b63ca
2 changed files with 18 additions and 12 deletions

View File

@ -92,7 +92,7 @@ dev-scan:
[group('dev')]
dev-full:
go run ./cmd/angela update --scan-vulns --file testdata/pyproject.toml
go run ./cmd/angela update --vulns --file testdata/pyproject.toml
# =============================================================================
# Build (Production)

View File

@ -21,7 +21,7 @@ import (
type updateFlags struct {
file string
safe bool
scanVulns bool
vulns bool
includePrerelease bool
}
@ -61,8 +61,9 @@ func newUpdateCmd() *cobra.Command {
f := &updateFlags{}
cmd := &cobra.Command{
Use: "update",
Short: "Update dependencies to latest stable versions",
Use: "update",
Aliases: []string{"u"},
Short: "Update dependencies to latest stable versions",
RunE: func(cmd *cobra.Command, _ []string) error {
return runUpdate(cmd.Context(), f, false)
},
@ -77,7 +78,7 @@ func newUpdateCmd() *cobra.Command {
"skip major version bumps",
)
cmd.Flags().BoolVar(
&f.scanVulns, "scan-vulns", false,
&f.vulns, "vulns", false,
"also scan for vulnerabilities",
)
cmd.Flags().BoolVar(
@ -91,10 +92,10 @@ func newCheckCmd() *cobra.Command {
f := &updateFlags{}
cmd := &cobra.Command{
Use: "check",
Short: "Show available updates without modifying files",
Use: "check",
Aliases: []string{"c"},
Short: "Show available updates without modifying files",
RunE: func(cmd *cobra.Command, _ []string) error {
f.scanVulns = true
return runUpdate(cmd.Context(), f, true)
},
}
@ -107,6 +108,10 @@ func newCheckCmd() *cobra.Command {
&f.safe, "safe", false,
"skip major version bumps",
)
cmd.Flags().BoolVar(
&f.vulns, "vulns", false,
"also scan for vulnerabilities",
)
cmd.Flags().BoolVar(
&f.includePrerelease, "include-prerelease", false,
"include pre-release versions",
@ -118,8 +123,9 @@ func newScanCmd() *cobra.Command {
var file string
cmd := &cobra.Command{
Use: "scan",
Short: "Scan dependencies for known vulnerabilities",
Use: "scan",
Aliases: []string{"s"},
Short: "Scan dependencies for known vulnerabilities",
RunE: func(cmd *cobra.Command, _ []string) error {
return runScan(cmd.Context(), file)
},
@ -196,7 +202,7 @@ func runUpdate(
sortUpdates(updates)
var vulns map[string][]types.Vulnerability
if f.scanVulns {
if f.vulns {
vulns = scanForVulns(ctx, deps)
}
@ -224,7 +230,7 @@ func runUpdate(
TotalPackages: len(deps),
TotalUpdated: len(updateSpecs),
TotalVulns: totalVulns,
VulnsScanned: f.scanVulns,
VulnsScanned: f.vulns,
Duration: time.Since(start),
}, !dryRun && len(updateSpecs) > 0)