Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions cmd/install.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package cmd

import (
"github.com/spf13/cobra"

"github.com/privateerproj/privateer-sdk/command"
)

var installCmd *cobra.Command

func init() {
installCmd = &cobra.Command{
Use: "install [plugin-name]",
Short: "Install a vetted plugin from the registry.",
Long: "Resolve the plugin name to registry metadata, then download the plugin binary from the release URL into the binaries path.",
Args: cobra.ExactArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
sdkInstall := command.GetInstallCmd(writer)
sdkInstall.SetArgs(args)
return sdkInstall.Execute()
},
}
rootCmd.AddCommand(installCmd)
}
13 changes: 1 addition & 12 deletions cmd/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package cmd

import (
"github.com/spf13/cobra"
"github.com/spf13/viper"

"github.com/privateerproj/privateer-sdk/command"
)
Expand All @@ -11,24 +10,14 @@ import (
var listCmd *cobra.Command

func init() {
// Create a wrapper command that gets the writer at runtime
// This is necessary because writer is nil at package init time
// and only gets initialized in persistentPreRun()
listCmd = &cobra.Command{
Use: "list",
Short: "Consult the Charts! List all plugins that have been installed.",
Run: func(cmd *cobra.Command, args []string) {
// Get the list command from SDK with the initialized writer
// At this point, writer has been initialized by persistentPreRun()
sdkListCmd := command.GetListCmd(writer)
// Execute the SDK command's Run function
sdkListCmd.Run(cmd, args)
},
}

// Add flags (matching the SDK command)
listCmd.PersistentFlags().BoolP("all", "a", false, "Review the Fleet! List all plugins that have been installed or requested in the current config")
_ = viper.BindPFlag("all", listCmd.PersistentFlags().Lookup("all"))

command.SetListCmdFlags(listCmd)
rootCmd.AddCommand(listCmd)
}
2 changes: 1 addition & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func Run() (exitCode int) {
// Setup for handling SIGTERM (Ctrl+C)
setupCloseHandler()

return command.Run(logger, command.GetPlugins)
return command.Run(logger, command.GetInstalledPlugins)
}

// setupCloseHandler creates a signal listener on a new goroutine which will notify
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ require (
)

// For SDK Development Only
// replace github.com/privateerproj/privateer-sdk => ../privateer-sdk
replace github.com/privateerproj/privateer-sdk => ../privateer-sdk

// Use local go-gemara when developing (same as privateer-sdk); replace is not transitive
// replace github.com/gemaraproj/go-gemara => ../../gemaraproj/go-gemara
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,6 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/privateerproj/privateer-sdk v1.20.0 h1:QdXhUJIG9XCfcD+ar9PFMv5Gjf8gzETzKYgnJ7tLBTA=
github.com/privateerproj/privateer-sdk v1.20.0/go.mod h1:kU4oaUY9CyqjxDkxs/TEjKvnkSt5MvDtqIhn0ZvgG8U=
github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ=
github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
Expand Down
Loading