INNER CODE UNIT · Go

init

corneliusweig/rakkess · cmd/root.go:146

func init() {
	klog.InitFlags(flag.CommandLine)
	rootCmd.PersistentFlags().AddGoFlagSet(flag.CommandLine)

	AddRakkessFlags(rootCmd)
	rootCmd.Flags().StringVar(&opts.AsServiceAccount, constants.FlagServiceAccount, "", "similar to --as, but impersonate as service-account. The argument must be qualified <namespace>:<sa-name> or be combined with the --namespace option. Takes precedence over --as.")

	rootCmd.PersistentPreRun = func(cmd *cobra.Command, args []string) {
		opts.ExpandVerbs()
	}
	rootCmd.PreRunE = func(cmd *cobra.Command, args []string) error {
		return opts.ExpandServiceAccount()
	}
}

// AddRakkessFlags sets up common flags for subcommands.
func AddRakkessFlags(cmd *cobra.Command) {
	cmd.Flags().StringSliceVar(&opts.Verbs, constants.FlagVerbs, []string{"list", "create", "update", "delete"}, fmt.Sprintf("show access for verbs out of (%s)", strings.Join(constants.ValidVerbs, ", ")))

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…