Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StatusListener ¶
func StatusListener(o Output, m *module.Module) license.StatusListener
StatusListener returns a license.StatusListener implementation for a single module to route to an Output implementation.
The caller must still call Start and Finish appropriately on the Output while using this StatusListener.
Types ¶
type CSVOutput ¶
type CSVOutput struct {
Path string
Config *config.Config
sync.Mutex
// contains filtered or unexported fields
}
type MultiOutput ¶
type MultiOutput struct {
Outputs []Output
}
MultiOutput calls the functions of multiple Output implementations.
func (*MultiOutput) Update ¶
func (o *MultiOutput) Update(m *module.Module, t license.StatusType, msg string)
Update implements Output
type Output ¶
type Output interface {
// Start is called when the license lookup for a module is started.
Start(*module.Module)
// Update is called for each status update during the license lookup.
Update(*module.Module, license.StatusType, string)
// Finish is called when a module license lookup is complete with
// the results of the lookup.
Finish(*module.Module, *license.License, error)
// Close is called when all modules lookups are completed. This can be
// used to output a summary report, if any.
Close() error
}
Output represents the output format for the progress and completion of license lookups. This can be implemented to introduce new UI styles or output formats (like JSON, etc.).
type TermOutput ¶
type TermOutput struct {
// Out is the stdout to write to. If this is a TTY, TermOutput will
// automatically use a "live" updating output mode for status updates.
// This can be disabled by setting Plain to true below.
Out io.Writer
// Config is the configuration (if any). This will be used to check
// if a license is allowed or not.
Config *config.Config
// Modules is the full list of modules that will be checked. This is
// optional. If this is given in advance, then the output will be cleanly
// aligned.
Modules []module.Module
// Plain, if true, will use the plain output vs the live updating output.
// TermOutput will always use Plain output if the Out configured above
// is not a TTY.
Plain bool
// Verbose will log all status updates in plain mode. This has no effect
// in non-plain mode currently.
Verbose bool
// contains filtered or unexported fields
}
TermOutput is an Output implementation that outputs to the terminal.
func (*TermOutput) ExitCode ¶
func (o *TermOutput) ExitCode() int
func (*TermOutput) Update ¶
func (o *TermOutput) Update(m *module.Module, t license.StatusType, msg string)
Update implements Output
type XLSXOutput ¶
type XLSXOutput struct {
// Path is the path to the file to write. This will be overwritten if
// it exists.
Path string
// Config is the configuration (if any). This will be used to check
// if a license is allowed or not.
Config *config.Config
// contains filtered or unexported fields
}
XLSXOutput writes the results of license lookups to an XLSX file.
func (*XLSXOutput) Update ¶
func (o *XLSXOutput) Update(m *module.Module, t license.StatusType, msg string)
Update implements Output