code: func Run() int {
  	log.SetOutput(ErrorWriter)
  
  	root := NewCommand("git-lfs", gitlfsCommand)
  	root.PreRun = nil
  
  	// Set up help/usage funcs based on manpage text
  	helpcmd := &cobra.Command{
  		Use:   "help [command]",
  		Short: "Help about any command",
  		Long: `Help provides help for any command in the application.
  Simply type ` + root.Name() + ` help [path to command] for full details.`,
  
  		Run: func(c *cobra.Command, args []string) {
  			cmd, _, e := c.Root().Find(args)
  			if cmd == nil || e != nil {
  				c.Printf("Unknown help topic %#q\n", args)
  				c.Root().Usage()
  			} else {
  				c.HelpFunc()(cmd, args)
  			}
  		},
  	}
  
  	root.SetHelpCommand(helpcmd)
  
  	root.SetHelpTemplate("{{.UsageString}}")
  	root.SetHelpFunc(helpCommand)
  	root.SetUsageFunc(usageCommand)
  
  	root.Flags().BoolVarP(&rootVersion, "version", "v", false, "")
  
  	cfg = config.New()
  
  	for _, f := range commandFuncs {
  		if cmd := f(); cmd != nil {
  			root.AddCommand(cmd)
  		}
  	}
  
  	err := root.Execute()
  	closeAPIClient()
  
  	if err != nil {
  		return 127
  	}
  	return 0
  }
docs: // Run initializes the 'git-lfs' command and runs it with the given stdin and
  // command line args.
  //
  // It returns an exit code.