35 lines
581 B
Go
35 lines
581 B
Go
package hmsecrets
|
|
|
|
import (
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
var mapValue map[string]string
|
|
|
|
func init() {
|
|
rootCmd.AddCommand(setMapCmd)
|
|
|
|
setMapCmd.Flags().StringToStringVarP(
|
|
&mapValue,
|
|
"map-value",
|
|
"v",
|
|
nil,
|
|
"map value to store in the secret",
|
|
)
|
|
setArrCmd.MarkFlagRequired("map-value")
|
|
}
|
|
|
|
var setMapCmd = &cobra.Command{
|
|
Use: "set-map",
|
|
Short: "set-map [key]",
|
|
Args: cobra.ExactArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
cli := getClient()
|
|
err := cli.PutStringMap(args[0], mapValue)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
return nil
|
|
},
|
|
}
|