// NewGui returns a new Gui object with a given output mode.
10237
func NewGui(mode OutputMode) (*Gui, error) {
	if err := termbox.Init(); err != nil {
		return nil, err
	}

	g := &Gui{}

	g.outputMode = mode
	termbox.SetOutputMode(termbox.OutputMode(mode))

	g.tbEvents = make(chan termbox.Event, 20)
	g.userEvents = make(chan userEvent, 20)

	g.maxX, g.maxY = termbox.Size()

	g.BgColor, g.FgColor = ColorDefault, ColorDefault
	g.SelBgColor, g.SelFgColor = ColorDefault, ColorDefault

	return g, nil
}
1107473
func Newf(cause error, format string, args ...interface{}) Error {
	return makeErrorf(UnknownErrorError, cause, format, args...)
}
240197
func New() (*Terminal, error) {
	var t Terminal

	// Get the actual state
	if err := sys.Getattr(InputFD, &t.lastState); err != nil {
		return nil, os.NewSyscallError("sys.Getattr", err)
	}

	t.oldState = t.lastState // the actual state is copied to another one
	t.fd = InputFD
	return &t, nil
}
1117641
func NewFactory(generator Generator, store Store) *Factory {
	return &Factory{
		store:     store,
		generator: generator,
	}
}
1071479
func New(initializer Initializer, opts ...options.Opt) *Reference {
	return NewWithData(func(interface{}) (interface{}, error) {
		return initializer()
	}, opts...)
}
748949
func NewCmd(fullName string, f kcmdutil.Factory, streams genericclioptions.IOStreams) *cobra.Command {
	image := &cobra.Command{
		Use:   "registry COMMAND",
		Short: "Commands for working with the registry",
		Long:  imageLong,
		Run:   kcmdutil.DefaultSubCommandRun(streams.ErrOut),
	}

	name := fmt.Sprintf("%s registry", fullName)

	groups := ktemplates.CommandGroups{
		{
			Message: "Advanced commands:",
			Commands: []*cobra.Command{
				info.NewRegistryInfoCmd(name, f, streams),
				login.NewRegistryLoginCmd(name, f, streams),
			},
		},
	}
	groups.Add(image)
	templates.ActsAsRootCommand(image, []string{"options"}, groups...)
	return image
}
510748
func (c *Config) NewKey(k string) Key {
	return c.KeyParser.Parse(k)
}
1356794
func NewConfig() *Config {
	c := new(Config)
	c.Incoming.Port = defaultPort
	return c
}
1290392
func New(bus Connection, rowAddr RowAddress, modes ...ModeSetter) (*HD44780, error) {
	controller := &HD44780{
		Connection: bus,
		eMode:      0x00,
		dMode:      0x00,
		fMode:      0x00,
		rowAddr:    rowAddr,
	}
	err := controller.lcdInit()
	if err != nil {
		return nil, err
	}
	err = controller.SetMode(append(DefaultModes, modes...)...)
	if err != nil {
		return nil, err
	}
	return controller, nil
}
1049002
func New(o io.Writer, s spin.Spinner, text string, options ...func(*Wow)) *Wow {
	isTerminal := terminal.IsTerminal(int(os.Stdout.Fd()))

	wow := Wow{out: o, s: s, txt: text, IsTerminal: isTerminal}

	for _, option := range options {
		option(&wow)
	}
	return &wow
}
1077416
func New(port string, baud int) *serialRecorder {
	return &serialRecorder{
		port:        port,
		baud:        baud,
		Logger:      os.Stdout,
		writeBuffer: make(chan *Row, 100),
	}
}
426371
func New(t T) *I {
	return &I{t, t.FailNow, os.Stdout, !noColorFlag}
}
1286935
func NewModeAnsiColorWriter(w io.Writer, mode outputMode) io.Writer {
	if _, ok := w.(*ansiColorWriter); !ok {
		return &ansiColorWriter{
			w:    w,
			mode: mode,
		}
	}
	return w
}
177115
func New(config Config) (*Console, error) {
	// Handle unset config values gracefully
	if config.Prompter == nil {
		config.Prompter = Stdin
	}
	if config.Prompt == "" {
		config.Prompt = DefaultPrompt
	}
	if config.Printer == nil {
		config.Printer = colorable.NewColorableStdout()
	}
	// Initialize the console and return
	console := &Console{
		client:   config.Client,
		jsre:     jsre.New(config.DocRoot, config.Printer),
		prompt:   config.Prompt,
		prompter: config.Prompter,
		printer:  config.Printer,
		histPath: filepath.Join(config.DataDir, HistoryFile),
	}
	if err := os.MkdirAll(config.DataDir, 0700); err != nil {
		return nil, err
	}
	if err := console.init(config.Preload); err != nil {
		return nil, err
	}
	return console, nil
}
203753
func New(delim byte, input io.Reader, output io.Writer, defaultColor colors.Color) *Prompt {
	if delim == 0 {
		delim = '\n'
	}

	if !defaultColor.IsValid() {
		panic("无效的颜色值 defaultColor")
	}

	return &Prompt{
		reader:       bufio.NewReader(input),
		output:       output,
		delim:        delim,
		defaultColor: defaultColor,
	}
}
1077781
func New(cfg ...Config) *Engine {
	c := DefaultConfig()
	if len(cfg) > 0 {
		c = cfg[0]
	}
	// cuz mergo has a little bug on maps
	if c.Funcs == nil {
		c.Funcs = make(map[string]interface{}, 0)
	}
	if c.LayoutFuncs == nil {
		c.LayoutFuncs = make(map[string]interface{}, 0)
	}
	e := &Engine{Config: c}
	return e
}
1007469
func NewConfig(confName string) (ConfigInterface, error) {
	c := &Config{
		data: make(map[string]map[string]string),
	}
	err := c.parse(confName)
	return c, err
}