anchor.diff:      %[1]s second --latest`)
   )
   
  +func NewMineOptions(streams genericclioptions.IOStreams) *MineOptions {
  +  return &MineOptions{
  +    PrintFlags: genericclioptions.NewPrintFlags("this message is printed on command success").WithTypeSetter(scheme.Scheme), // here we instantiate our PrintFlags		
  +
  +    mineLatest: true, // perform flag defaulting here
  +    IOStreams: streams,
  +  }
  +}
  +
   // NewCmdMine implement the OpenShift cli mine command.
  -func NewCmdMine(name, fullName string, f *clientcmd.Factory, out io.Writer) *cobra.Command {
  -  options := &MineOptions{}
  +func NewCmdMine(name, fullName string, f *clientcmd.Factory, streams genericclioptions.IOStreams) *cobra.Command {
  +  o := NewMineOptions(streams)
     cmd := &cobra.Command{
       Use:     fmt.Sprintf("%s [--latest]", name),
       Short:   "Run my command",
       Long:    mineLong,
       Example: fmt.Sprintf(mineExample, fullName),
       Run: func(cmd *cobra.Command, args []string) {
  -      if err := options.Complete(f, cmd, args, out); err != nil { (6)
  -        cmdutil.CheckErr(err)
  -      }
  -      if err := options.Validate(args); err != nil { (7)
  -        cmdutil.CheckErr(cmdutil.UsageErrorf(cmd, err.Error()))
  -      }
  -      if err := options.RunDeploy(); err != nil { (8)
  -        cmdutil.CheckErr(err) (9)
  -      }
  +      kcmdutil.CheckErr(o.Complete(f, cmd, args))
  +      kcmdutil.CheckErr(o.Validate())
  +      kcmdutil.CheckErr(o.Run())
       },
     }
  -  cmd.Flags().BoolVar(&options.mineLatest, "latest", false, "Use latest stuff")
  +
  +  // always use <Type>Var cobra methods, as they allow us to bind flag values
  +  // directly to struct fields by passing their address as the first parameter.
  +  cmd.Flags().BoolVar(&o.mineLatest, "latest", o.mineLatest, "Use latest stuff")
  +
  +  // make sure to bind any printing flags if the command makes use of the printing stack
  +  o.PrintFlags.AddFlags(cmd)
     return cmd
   }
   
   // Complete completes all the required options for mine.
  -func (o *MineOptions) Complete(f *clientcmd.Factory, cmd *cobra.Command, args []string, out io.Writer) error {
  +func (o *MineOptions) Complete(f *clientcmd.Factory, cmd *cobra.Command, args []string) error { 
  +  // obtain a printer from our PrintFlags
  +  var err error
  +  o.Printer, err = o.PrintFlags.ToPrinter()
  +  return err
  +}
  +
  +// Validate validates all the required options for mine.
  +func (o *MineOptions) Validate() error {
     return nil
   }
   
  -// Validate validates all the required options for mine.
  -func (o MineOptions) Validate() error {
  +// Run implements all the necessary functionality for mine.
  +func (o *MineOptions) Run() error {
     return nil
   }
  -
  -// RunMine implements all the necessary functionality for mine.
  -func (o MineOptions) RunMine() error {
  -  return nil
  -}
  -----
  -====
  -
  -Notice that this is not a mandatory structure and not every command is implemented this way (specially in regarding to the "holding" struct and its methods), but this is a nice convention so try to be compliant with it.
  +----
  +====
   
   === Writing Usage
   
  -When writing an usage string, make sure you cover the most important path for the given command. Use the following conventions:
  +When writing a usage string, make sure you cover the most important path for the given command. Use the following conventions:
   
   * Arguments and flag values names in upper case, e.g. `RESOURCE`, `-n NAME`.
   * Optional arguments or flags between brackets, e.g. `[RESOURCE]`, `[-f FILENAME]`.
  
positive.code: 
  // MineOptions contains all the options for running the mine cli command
  type MineOptions struct {
    mineLatest bool
  }
  
  var (
  
negative.code:     %[1]s database --latest`)
  )
  
  // 4
  func NewDeployOptions(streams genericclioptions.IOStreams) *DeployOptions {
    return &DeployOptions{
      PrintFlags: genericclioptions.NewPrintFlags("deployed").WithTypeSetter(scheme.Scheme),
      IOStreams: streams,
    }
  }
  
  // 5
  func NewCmdDeploy(name, fullName string, f *clientcmd.Factory, streams genericclioptions.IOStreams) *cobra.Command {
    o := NewDeployOptions(streams)
  
    cmd := &cobra.Command{
      // 6.
      Use:     fmt.Sprintf("%s DEPLOYMENTCONFIG", name),
      Short:   "View, start, cancel, or retry deployments",
      Long:    deployLong,
      Example: fmt.Sprintf(deployExample, fullName),
      Run: func(cmd *cobra.Command, args []string) {
        // 7.
        kcmdutil.CheckErr(o.Complete(f, cmd, args))
  
        // 8.
        kcmdutil.CheckErr(o.Validate())
  
        // 9.
        kcmdutil.CheckErr(o.Run())
      },
    }
  
    cmd.Flags().BoolVar(&options.deployLatest, "latest", false, "Start a new deployment now.")
    cmd.Flags().BoolVar(&options.retryDeploy, "retry", false, "Retry the latest failed deployment.")
  
    // 10.
    o.PrintFlags.AddFlags(cmd)
    return cmd
  }
  
  func (o *DeployOptions) Complete(f *clientcmd.Factory, cmd *cobra.Command, args []string) error {
    // 11.
    var err error
    o.Printer, err = o.PrintFlags.ToPrinter()
    return err
  }
  
  func (o DeployOptions) Validate() error {
    return nil
  }
  
  func (o DeployOptions) Run() error {
    return nil
  }
  ----
  <1> Create a struct to contain vars for every flag declared (and other vars that the command may need). This struct will usually have the `Complete`, `Validate` and `Run<Command>` methods (explained below).
  <2> Multiple lines describing the command.
  <3> Command examples. Try to cover every important command path (flags, arguments, etc).
  <4> Create a "constructor" for the command options struct. Here you will instantiate command options, default any values, and set the IO streams for writing to the screen. 
  <5> This function creates the command. Notice it takes the parent command name as argument and also a `io.Writer` that will be used to print messages.
  <6> Command usage.
  <7> `Complete(f *clientcmd.Factory, cmd *cobra.Command, args []string) error` is used to populate any object or variable that will be required to run the command and is still missing at this point. For example, if the command will make use of an API client it can be created from the factory in this method. Can also be used to take argument values from the `args` slice and hold it in explicit variables in your struct, store the `io.Writer` that will be used later, etc.
  <8> `Validate() error` perform validations on anything required in order to run this command. Notice that if the `Complete` and `Validate` methods implementations are simple enough, you may have only one of them that does both.
  <9> `Run() error` does the actual command logic and returns errors as required. Notice that this method does not take anything as argument - it's expected that you previously extracted and stored in the `struct` anything that will be needed to run this command. This makes commands more easily testable once you can run and populate the command struct with the values you want to test and then just run this method and check for the returned error(s).
  Try to always use the functions in `k8s.io/kubernetes/pkg/kubectl/cmd/util` to check and handle errors. It is not expected that commands call `glog.Fatalf`, `os.Exit` or anything similar directly.
  <10> Always remember to bind printer-related flags, if your command makes use of the printing stack.
  <11> Similarly, remember to retrieve a valid printer from the printer-related flags struct in your `Complete` method. The printer obtained in this step will always be the correct printer based on the output-format specified by the user.
  
  ====
  
  
  
  
  