Documentation
¶
Overview ¶
Package launchr has application implementation.
Index ¶
- Constants
- func EnsurePath(parts ...string) error
- func FsRealpath(fs fs.FS) string
- func Gen() int
- func GenAndExit()
- func MustAbs(path string) string
- func MustSubFS(fsys fs.FS, path string) fs.FS
- func NewExitError(code int, msg string) error
- func NewMaskingWriter(w io.Writer, mask *SensitiveMask) io.WriteCloser
- func RegisterCleanupFn(fn func() error)
- func RegisterPlugin(p Plugin)
- func Run() int
- func RunAndExit()
- func SetLogger(l *Logger)
- func StdInOutErr() (stdIn io.ReadCloser, stdOut, stdErr io.Writer)
- type ActionDiscoveryPlugin
- type App
- type AppVersion
- type CobraPlugin
- type Command
- type Config
- type EnvVar
- type ExitError
- type GenerateConfig
- type GeneratePlugin
- type In
- type LogLevel
- type LogOptions
- type Logger
- type ManagedFS
- type MaskingWriter
- type OnAppInitPlugin
- type Out
- type PersistentPreRunPlugin
- type Plugin
- type PluginInfo
- type PluginManager
- type SensitiveMask
- type Service
- type ServiceInfo
- type Slog
- type Streams
- type Template
- type Terminal
- type TextPrinter
Constants ¶
const ( LogLevelDisabled = launchr.LogLevelDisabled // LogLevelDisabled does never print. LogLevelDebug = launchr.LogLevelDebug // LogLevelDebug is the log level for debug. LogLevelInfo = launchr.LogLevelInfo // LogLevelInfo is the log level for info. LogLevelWarn = launchr.LogLevelWarn // LogLevelWarn is the log level for warnings. LogLevelError = launchr.LogLevelError // LogLevelError is the log level for errors. )
Log levels.
const ( // EnvVarRootParentPID defines parent process id. May be used by forked processes. EnvVarRootParentPID = launchr.EnvVarRootParentPID // EnvVarActionsPath defines path where to search for actions. EnvVarActionsPath = launchr.EnvVarActionsPath // EnvVarLogLevel defines currently set log level. EnvVarLogLevel = launchr.EnvVarLogLevel // EnvVarLogFormat defines currently set log format, see --log-format flag. EnvVarLogFormat = launchr.EnvVarLogFormat // EnvVarQuietMode defines if the application should output anything, see --quiet flag. EnvVarQuietMode = launchr.EnvVarQuietMode )
Application environment variables.
const PkgPath = launchr.PkgPath
PkgPath is a main module path.
Variables ¶
This section is empty.
Functions ¶
func EnsurePath ¶ added in v0.0.9
EnsurePath creates all directories in the path.
func FsRealpath ¶ added in v0.18.0
FsRealpath returns absolute path for a fs.FS interface.
func GenAndExit ¶ added in v0.16.0
func GenAndExit()
GenAndExit runs the generation and exits with a result code.
func MustSubFS ¶ added in v0.18.0
MustSubFS returns an fs.FS corresponding to the subtree rooted at fsys's dir.
func NewExitError ¶ added in v0.16.4
NewExitError creates a new ExitError.
func NewMaskingWriter ¶ added in v0.19.0
func NewMaskingWriter(w io.Writer, mask *SensitiveMask) io.WriteCloser
NewMaskingWriter initializes a new MaskingWriter.
func RegisterCleanupFn ¶ added in v0.18.0
func RegisterCleanupFn(fn func() error)
RegisterCleanupFn saves a function to be executed on Cleanup. It is run on the termination of the application.
func RunAndExit ¶ added in v0.16.0
func RunAndExit()
RunAndExit runs the application and exits with a result code.
func StdInOutErr ¶ added in v0.19.0
func StdInOutErr() (stdIn io.ReadCloser, stdOut, stdErr io.Writer)
StdInOutErr returns the standard streams (stdin, stdout, stderr).
On Windows, it attempts to turn on VT handling on all std handles if supported, or falls back to terminal emulation. On Unix, this returns the standard os.Stdin, os.Stdout and os.Stderr.
Types ¶
type ActionDiscoveryPlugin ¶ added in v0.5.4
type ActionDiscoveryPlugin = action.DiscoveryPlugin
ActionDiscoveryPlugin is an interface to implement a plugin to discover actions.
type CobraPlugin ¶
type CobraPlugin = launchr.CobraPlugin
CobraPlugin is an interface to implement a plugin for cobra.
type EnvVar ¶ added in v0.19.0
EnvVar defines an environment variable and provides an interface to interact with it by prefixing the current app name. For example, if "my_var" is given as the variable name and the app name is "launchr", the accessed environment variable will be "LAUNCHR_MY_VAR".
type GenerateConfig ¶ added in v0.16.3
type GenerateConfig = launchr.GenerateConfig
GenerateConfig defines generation config.
type GeneratePlugin ¶
type GeneratePlugin = launchr.GeneratePlugin
GeneratePlugin is an interface to generate supporting files before build.
type In ¶ added in v0.16.0
In is an input stream used by the app to read user input.
func NewIn ¶ added in v0.16.0
func NewIn(in io.ReadCloser) *In
NewIn returns a new In object from a io.ReadCloser.
type LogOptions ¶ added in v0.16.0
type LogOptions = launchr.LogOptions
LogOptions is a common interface to allow adjusting the logger.
type Logger ¶ added in v0.16.0
Logger is a logger and its config holder struct.
func NewConsoleLogger ¶ added in v0.16.0
NewConsoleLogger creates a default console logger.
func NewJSONHandlerLogger ¶ added in v0.16.0
NewJSONHandlerLogger creates a logger with a io.Writer and JSON output.
type MaskingWriter ¶ added in v0.19.0
type MaskingWriter = launchr.MaskingWriter
MaskingWriter is a writer that masks sensitive data in the input stream. It buffers data to handle cases where sensitive data spans across writes.
type OnAppInitPlugin ¶ added in v0.1.0
type OnAppInitPlugin = launchr.OnAppInitPlugin
OnAppInitPlugin is an interface to implement a plugin for app initialisation.
type PersistentPreRunPlugin ¶ added in v0.19.0
type PersistentPreRunPlugin = launchr.PersistentPreRunPlugin
PersistentPreRunPlugin is an interface to implement a plugin to run before any command is run and all arguments are parsed.
type PluginInfo ¶
type PluginInfo = launchr.PluginInfo
PluginInfo provides information about the plugin and is used as a unique data to indentify a plugin.
type PluginManager ¶ added in v0.0.8
type PluginManager = launchr.PluginManager
PluginManager handles plugins.
type SensitiveMask ¶ added in v0.19.0
type SensitiveMask = launchr.SensitiveMask
SensitiveMask replaces sensitive strings with a mask.
type ServiceInfo ¶ added in v0.0.8
type ServiceInfo = launchr.ServiceInfo
ServiceInfo provides service info for its initialization.
type Slog ¶ added in v0.16.0
Slog is an alias for a go structured logger [slog.Logger] to reduce visible dependencies.
type Streams ¶ added in v0.16.0
Streams is an interface which exposes the standard input and output streams.
func MaskedStdStreams ¶ added in v0.19.0
func MaskedStdStreams(mask *SensitiveMask) Streams
MaskedStdStreams sets a cli in, out and err streams with the standard streams and with masking of sensitive data.
func NewBasicStreams ¶ added in v0.19.0
func NewBasicStreams(in io.ReadCloser, out io.Writer, err io.Writer, fns ...launchr.StreamsModifierFn) Streams
NewBasicStreams creates streams with given in, out and err streams. Give decorate functions to extend functionality.
func NoopStreams ¶ added in v0.16.0
func NoopStreams() Streams
NoopStreams provides streams like /dev/null.
type TextPrinter ¶ added in v0.16.0
type TextPrinter = launchr.TextPrinter
TextPrinter contains methods to print formatted text to the console or return it as a string.
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
launchr
command
Package executes Launchr application.
|
Package executes Launchr application. |
example
|
|
plugins/action_embedfs
Package action_embedfs contains an example how to create a plugin that provides actions in embed fs.
|
Package action_embedfs contains an example how to create a plugin that provides actions in embed fs. |
plugins/action_runtime_plugin
Package action_runtime_plugin provides an example of creating an action with the runtime type "plugin".
|
Package action_runtime_plugin provides an example of creating an action with the runtime type "plugin". |
internal
|
|
launchr
Package launchr provides common app functionality.
|
Package launchr provides common app functionality. |
pkg
|
|
action
Package action provides implementations of discovering and running actions.
|
Package action provides implementations of discovering and running actions. |
archive
Package archive contains functionality for archiving/unarchiving streams.
|
Package archive contains functionality for archiving/unarchiving streams. |
driver
Package driver hold implementation for container runtimes.
|
Package driver hold implementation for container runtimes. |
driver/mocks
Package mocks is a generated GoMock package.
|
Package mocks is a generated GoMock package. |
jsonschema
Package jsonschema has functionality related to json schema support.
|
Package jsonschema has functionality related to json schema support. |
Package plugins provides launchr core plugins.
|
Package plugins provides launchr core plugins. |
actionnaming
Package actionnaming is a plugin of launchr to adjust action ids.
|
Package actionnaming is a plugin of launchr to adjust action ids. |
actionscobra
Package actionscobra is a launchr plugin providing cobra interface to actions.
|
Package actionscobra is a launchr plugin providing cobra interface to actions. |
builder
Package builder implements launchr functionality to build itself.
|
Package builder implements launchr functionality to build itself. |
builtinprocessors
Package builtinprocessors is a plugin of launchr to provide native action processors.
|
Package builtinprocessors is a plugin of launchr to provide native action processors. |
verbosity
Package verbosity is a plugin of launchr to configure log level of the app.
|
Package verbosity is a plugin of launchr to configure log level of the app. |
yamldiscovery
Package yamldiscovery implements a launchr plugin to discover actions defined in yaml.
|
Package yamldiscovery implements a launchr plugin to discover actions defined in yaml. |
yamldiscovery/embed
Package embed provides yaml discovery with embed actions definition.
|
Package embed provides yaml discovery with embed actions definition. |