Documentation
¶
Overview ¶
MIT License
Copyright (c) 2022 Thomas Ziegler, <[email protected]>. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Index ¶
- type MOut
- func (m *MOut) Err() *MOut
- func (m *MOut) GetParser() *OutParser
- func (m *MOut) Named(key string) *MOut
- func (m *MOut) Out(i ...interface{}) (n int, err error)
- func (m *MOut) OutLn(i ...interface{}) (n int, err error)
- func (m *MOut) SetNamedWriter(key string, io io.ReadWriter) *MOut
- func (m *MOut) SetParser(parser OutParser) *MOut
- func (m *MOut) Std() *MOut
- func (m *MOut) ToString(i ...interface{}) string
- type OutParser
- type OutputManager
- type PlainParse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MOut ¶
type MOut struct { Io io.ReadWriter // currently used ReadWriter NamedWriter string // if a named write is set, this will be the name Parser OutParser // used parser IsTerminal bool // if we cloud detect an terminal support Width int // the witdth of a terminal, if we have detect a terminal Height int // same for the height }
func (*MOut) Named ¶ added in v0.0.2
sets an named writer if exists. or ignores if not. writer have to be set with SetNamedWriter before.
func (*MOut) Out ¶ added in v0.0.2
Out print the formatted content by using fmt.Fprint have the same return values.
func (*MOut) OutLn ¶ added in v0.0.2
OutLn print the formatted content by using fmt.Fprintln it have the same return values like fmt.Fprintln
func (*MOut) SetNamedWriter ¶ added in v0.0.2
func (m *MOut) SetNamedWriter(key string, io io.ReadWriter) *MOut
register or overidde a io.Writer by key-name. also it will be set as the current writer
type OutParser ¶
type OutParser interface { Parse(i ...interface{}) string // parses all arguments and returns a composed string Enable(mo *MOut) bool // hook to disable or enable some features }
OutParser is the interface that is used by parsers
type OutputManager ¶ added in v0.0.2
type OutputManager interface { Std() *MOut // Points to the stdout Err() *MOut // Ponints to the Errout SetParser(parser OutParser) *MOut // sets the current parser GetParser() *OutParser // returns the surrent parser Named(key string) *MOut // Like Std() or Err() but for a assigned ReadWriter (SetNamedWriter) SetNamedWriter(key string, io io.ReadWriter) *MOut // adds an costume ReadWriter togehter with an name ToString(i ...interface{}) string // creates an String by using the current Parser Out(i ...interface{}) (n int, err error) // Print the output by using the current Parser and current ReadWriter, without line ending OutLn(i ...interface{}) (n int, err error) // sam as Out() but with line ending }
type PlainParse ¶ added in v0.0.2
type PlainParse struct { }
func (PlainParse) Enable ¶ added in v0.0.2
func (c PlainParse) Enable(mo *MOut) bool
func (PlainParse) Parse ¶ added in v0.0.2
func (c PlainParse) Parse(i ...interface{}) string