func (a *Application) Writer(w io.Writer) *Application {
	a.writer = w
	return a
}
Specify the writer to use for usage and errors. Defaults to os.Stderr.
package kingpin
import (
	"fmt"
	"io"
	"os"
	"strings"
)
var (
	ErrCommandNotSpecified = fmt.Errorf("command not specified")
)
type Action func(*ParseContext) error
type ApplicationValidator func(*Application) error
type Application struct {
	*flagGroup
	*argGroup
	*cmdGroup
	initialized   bool
	Name          string
	Help          string
	author        string
	version       string
	writer        io.Writer  
	usageTemplate string
	action        Action
	preAction     Action
	validator     ApplicationValidator
	terminate     func(status int)  
}
func New(name, help string) *Application {
	a := &Application{
		flagGroup:     newFlagGroup(),
		argGroup:      newArgGroup(),
		Name:          name,
		Help:          help,
		writer:        os.Stderr,
		usageTemplate: DefaultUsageTemplate,
		terminate:     os.Exit,
	}
	a.cmdGroup = newCmdGroup(a)
	a.Flag("help", "Show help (also see --help-long and --help-man).").Bool()
	a.Flag("help-long", "Generate long help.").Hidden().PreAction(a.generateLongHelp).Bool()
	a.Flag("help-man", "Generate a man page.").Hidden().PreAction(a.generateManPage).Bool()
	return a
}
func (a *Application) generateLongHelp(c *ParseContext) error {
	a.Writer(os.Stdout)
	if err := a.UsageForContextWithTemplate(c, 2, LongHelpTemplate); err != nil {
		return err
	}
	a.terminate(0)
	return nil
}
func (a *Application) generateManPage(c *ParseContext) error {
	a.Writer(os.Stdout)
	if err := a.UsageForContextWithTemplate(c, 2, ManPageTemplate); err != nil {
		return err
	}
	a.terminate(0)
	return nil
}
func (a *Application) Terminate(terminate func(int)) *Application {
	if terminate == nil {
		terminate = func(int) {}
	}
	a.terminate = terminate
	return a
}