mirror of
https://github.com/holos-run/holos.git
synced 2026-03-19 16:54:58 +00:00
This patch adds a get secret subcommand. With no args, lists holos secrets. With args, gets each argument. The use cases are: 1. Extract specified keys to files with --to-file 2. Extract all keys to files with --extract-all 3. Print one key to stdout with --print-key If no key is specified, the key is implicitly set to the holos secret name. This behavior should be preserved as part of the api.
24 lines
553 B
Go
24 lines
553 B
Go
package get
|
|
|
|
import (
|
|
"github.com/holos-run/holos/pkg/cli/command"
|
|
"github.com/holos-run/holos/pkg/cli/secret"
|
|
"github.com/holos-run/holos/pkg/holos"
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
// New returns the get command for the cli.
|
|
func New(hc *holos.Config) *cobra.Command {
|
|
cmd := command.New("get")
|
|
cmd.Short = "get resources"
|
|
cmd.Flags().SortFlags = false
|
|
cmd.RunE = func(c *cobra.Command, args []string) error {
|
|
return c.Usage()
|
|
}
|
|
// flags
|
|
cmd.PersistentFlags().SortFlags = false
|
|
// commands
|
|
cmd.AddCommand(secret.NewGetCmd(hc))
|
|
return cmd
|
|
}
|