code: func NewCmdCanI(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
  	o := &CanIOptions{
  		IOStreams: streams,
  	}
  
  	cmd := &cobra.Command{
  		Use:                   "can-i VERB [TYPE | TYPE/NAME | NONRESOURCEURL]",
  		DisableFlagsInUseLine: true,
  		Short:                 "Check whether an action is allowed",
  		Long:                  canILong,
  		Example:               canIExample,
  		Run: func(cmd *cobra.Command, args []string) {
  			cmdutil.CheckErr(o.Complete(f, args))
  			cmdutil.CheckErr(o.Validate())
  			var err error
  			if o.List {
  				err = o.RunAccessList()
  			} else {
  				var allowed bool
  				allowed, err = o.RunAccessCheck()
  				if err == nil {
  					if !allowed {
  						os.Exit(1)
  					}
  				}
  			}
  			cmdutil.CheckErr(err)
  		},
  	}
  
  	cmd.Flags().BoolVarP(&o.AllNamespaces, "all-namespaces", "A", o.AllNamespaces, "If true, check the specified action in all namespaces.")
  	cmd.Flags().BoolVarP(&o.Quiet, "quiet", "q", o.Quiet, "If true, suppress output and just return the exit code.")
  	cmd.Flags().StringVar(&o.Subresource, "subresource", o.Subresource, "SubResource such as pod/log or deployment/scale")
  	cmd.Flags().BoolVar(&o.List, "list", o.List, "If true, prints all allowed actions.")
  	cmd.Flags().BoolVar(&o.NoHeaders, "no-headers", o.NoHeaders, "If true, prints allowed actions without headers")
  	return cmd
  }
docs: // NewCmdCanI returns an initialized Command for 'auth can-i' sub command