code: func checkRequiredFlags(ctx *cli.Context) error {
  	missing := []string{}
  	for _, f := range ctx.Command.Flags {
  		var name string
  		flagMissing := false
  		switch pf := f.(type) {
  		case placeHolderStringFlag:
  			name = strings.SplitN(pf.GetName(), ",", 2)[0]
  			if pf.Required && ctx.String(name) == "" {
  				flagMissing = true
  			}
  		case placeHolderStringSliceFlag:
  			name = strings.SplitN(pf.GetName(), ",", 2)[0]
  			if pf.Required && len(ctx.StringSlice(name)) == 0 {
  				flagMissing = true
  			}
  
  		}
  		if flagMissing {
  			prefix := "-"
  			if len(name) > 1 {
  				prefix = "--"
  			}
  			missing = append(missing, prefix+name)
  		}
  
  	}
  
  	if len(missing) > 0 {
  		msg := "Missing flags: " + strings.Join(missing, ", ")
  		return errs.NewUsageExitError(msg, ctx)
  	}
  
  	return nil
  }
docs: // CheckRequiredFlags ensures that any required flags have been set either on
  // the command line, or through envvars/prefs files.