mirror of
https://github.com/anchore/syft.git
synced 2026-02-15 03:56:40 +01:00
feat: add new login cmd (#1068)
Co-authored-by: Christopher Phillips <christopher.phillips@anchore.com>
This commit is contained in:
parent
47df66960f
commit
69134ed3b5
@ -15,6 +15,7 @@ import (
|
|||||||
"github.com/anchore/syft/internal/log"
|
"github.com/anchore/syft/internal/log"
|
||||||
"github.com/anchore/syft/internal/version"
|
"github.com/anchore/syft/internal/version"
|
||||||
"github.com/anchore/syft/syft/event"
|
"github.com/anchore/syft/syft/event"
|
||||||
|
cranecmd "github.com/google/go-containerregistry/cmd/crane/cmd"
|
||||||
"github.com/gookit/color"
|
"github.com/gookit/color"
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
"github.com/spf13/viper"
|
"github.com/spf13/viper"
|
||||||
@ -30,6 +31,7 @@ const indent = " "
|
|||||||
// at this level. Values from the config should only be used after `app.LoadAllValues` has been called.
|
// at this level. Values from the config should only be used after `app.LoadAllValues` has been called.
|
||||||
// Cobra does not have knowledge of the user provided flags until the `RunE` block of each command.
|
// Cobra does not have knowledge of the user provided flags until the `RunE` block of each command.
|
||||||
// `RunE` is the earliest that the complete application configuration can be loaded.
|
// `RunE` is the earliest that the complete application configuration can be loaded.
|
||||||
|
// nolint:funlen
|
||||||
func New() (*cobra.Command, error) {
|
func New() (*cobra.Command, error) {
|
||||||
app := &config.Application{}
|
app := &config.Application{}
|
||||||
|
|
||||||
@ -82,13 +84,22 @@ func New() (*cobra.Command, error) {
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// commands to add to root
|
||||||
|
cmds := []*cobra.Command{
|
||||||
|
packagesCmd,
|
||||||
|
attestCmd,
|
||||||
|
convertCmd,
|
||||||
|
poweruserCmd,
|
||||||
|
poweruserCmd,
|
||||||
|
Completion(),
|
||||||
|
Version(v, app),
|
||||||
|
cranecmd.NewCmdAuthLogin("syft"),
|
||||||
|
}
|
||||||
|
|
||||||
// Add sub-commands.
|
// Add sub-commands.
|
||||||
rootCmd.AddCommand(packagesCmd)
|
for _, cmd := range cmds {
|
||||||
rootCmd.AddCommand(attestCmd)
|
rootCmd.AddCommand(cmd)
|
||||||
rootCmd.AddCommand(convertCmd)
|
}
|
||||||
rootCmd.AddCommand(poweruserCmd)
|
|
||||||
rootCmd.AddCommand(Completion())
|
|
||||||
rootCmd.AddCommand(Version(v, app))
|
|
||||||
|
|
||||||
return rootCmd, err
|
return rootCmd, err
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user