launchr

package module
v0.17.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 10 Imported by: 23

README

Launchr

Launchr is a CLI action runner that executes actions inside short-lived local containers.
Actions are defined in action.yaml files, which are automatically discovered in the filesystem. They can be placed anywhere that makes sense semantically. You can find action examples here and in the documentation.
Launchr has a plugin system that allows to extend its functionality. See core plugins, compose and documentation.

Table of contents

Usage

Build launchr from source locally. Build dependencies:

  1. go >=1.20, see installation guide
  2. make

Build the launchr tool:

make
bin/launchr --help

The documentation for launchr usage can be found in docs.

If you face any issues with launchr:

  1. Open an issue in the repo.
  2. Share the app version with launchr --version

Installation

Installation from source

Build dependencies:

  1. go >=1.20, see installation guide
  2. make

Global installation

Install launchr globally:

make install
launchr --version

The tool will be installed in $GOPATH/bin which is usually ~/go/bin.
If GOPATH env variable is not available, make sure you have it in ~/.bashrc or ~/.zhrc:

export GOPATH=`go env GOPATH`
export PATH=$PATH:$GOPATH/bin

Local installation

The tool can be built and run locally:

make
bin/launchr --version

Development

The launchr can be built with a make to bin directory:

make

It is also supported to make a build to use with dlv for debug:

make DEBUG=1

Useful make commands:

  1. Fetch dependencies - make deps
  2. Test the code - make test
  3. Lint the code - make lint

Publishing a new release

  1. Install goreleaser
  2. Create an Access token on GitHub
  3. Create a tag, build a release and push
    git tag -a v0.0.0 -m "Release notes"
    export GITHUB_TOKEN="[TOKEN]"
    goreleaser release --clean
    

Documentation

Overview

Package launchr has application implementation.

Index

Constants

View Source
const (
	// PkgPath is a main module path.
	PkgPath = launchr.PkgPath

	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.
)

Variables

This section is empty.

Functions

func EnsurePath added in v0.0.9

func EnsurePath(parts ...string) error

EnsurePath creates all directories in the path.

func Gen

func Gen() int

Gen generates application specific build files and returns os exit code.

func GenAndExit added in v0.16.0

func GenAndExit()

GenAndExit runs the generation and exits with a result code.

func GetFsAbsPath added in v0.0.9

func GetFsAbsPath(fs fs.FS) string

GetFsAbsPath returns absolute path for an FS struct.

func NewExitError added in v0.16.4

func NewExitError(code int, msg string) error

NewExitError creates a new ExitError.

func RegisterPlugin

func RegisterPlugin(p Plugin)

RegisterPlugin add a plugin to global pull.

func Run

func Run() int

Run executes the application.

func RunAndExit added in v0.16.0

func RunAndExit()

RunAndExit runs the application and exits with a result code.

func SetLogger added in v0.16.0

func SetLogger(l *Logger)

SetLogger sets the default logger.

Types

type ActionDiscoveryPlugin added in v0.5.4

type ActionDiscoveryPlugin = action.DiscoveryPlugin

ActionDiscoveryPlugin is an interface to implement a plugin to discover actions.

type ActionsAlterPlugin added in v0.14.0

type ActionsAlterPlugin = action.AlterActionsPlugin

ActionsAlterPlugin is in interface to implement a plugin to alter registered actions.

type App

type App = launchr.App

App stores global application state.

type AppVersion

type AppVersion = launchr.AppVersion

AppVersion stores application version.

func Version

func Version() *AppVersion

Version provides app version info.

type CobraPlugin

type CobraPlugin = launchr.CobraPlugin

CobraPlugin is an interface to implement a plugin for cobra.

type Command added in v0.16.0

type Command = launchr.Command

Command is an application command to execute.

type Config added in v0.1.0

type Config = launchr.Config

Config handles application configuration.

type ConfigAware added in v0.1.0

type ConfigAware = launchr.ConfigAware

ConfigAware provides an interface for structs to support launchr configuration setting.

type ExitError added in v0.16.4

type ExitError = launchr.ExitError

ExitError is an error holding an error code of executed command.

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

type In = launchr.In

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 LogLevel added in v0.16.0

type LogLevel = launchr.LogLevel

A LogLevel is the importance or severity of a log event.

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

type Logger = launchr.Logger

Logger is a logger and its config holder struct.

func Log added in v0.16.0

func Log() *Logger

Log returns the default logger.

func NewConsoleLogger added in v0.16.0

func NewConsoleLogger(w io.Writer) *Logger

NewConsoleLogger creates a default console logger.

func NewJSONHandlerLogger added in v0.16.0

func NewJSONHandlerLogger(w io.Writer) *Logger

NewJSONHandlerLogger creates a logger with a io.Writer and JSON output.

func NewTextHandlerLogger added in v0.16.0

func NewTextHandlerLogger(w io.Writer) *Logger

NewTextHandlerLogger creates a logger with a io.Writer and plain output.

type ManagedFS added in v0.5.5

type ManagedFS = launchr.ManagedFS

ManagedFS is a File System managed by launchr.

type OnAppInitPlugin added in v0.1.0

type OnAppInitPlugin = launchr.OnAppInitPlugin

OnAppInitPlugin is an interface to implement a plugin for app initialisation.

type Out added in v0.16.0

type Out = launchr.Out

Out is an output stream used by the app to write normal program output.

func NewOut added in v0.16.0

func NewOut(out io.Writer) *Out

NewOut returns a new Out object from a io.Writer.

type Plugin

type Plugin = launchr.Plugin

Plugin is a common interface for launchr plugins.

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 Service added in v0.0.8

type Service = launchr.Service

Service is a common interface for a service to register.

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

type Slog = launchr.Slog

Slog is an alias for a go structured logger [slog.Logger] to reduce visible dependencies.

type Streams added in v0.16.0

type Streams = launchr.Streams

Streams is an interface which exposes the standard input and output streams.

func NoopStreams added in v0.16.0

func NoopStreams() Streams

NoopStreams provides streams like /dev/null.

func StandardStreams added in v0.16.0

func StandardStreams() Streams

StandardStreams sets a cli in, out and err streams with the standard streams.

type Template added in v0.16.0

type Template = launchr.Template

Template provides templating functionality to generate files.

type Terminal added in v0.16.0

type Terminal = launchr.Terminal

Terminal prints formatted text to the console.

func Term added in v0.16.0

func Term() *Terminal

Term returns default Terminal to print application messages to the console.

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
Package executes Launchr application.
Package executes Launchr application.
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.
driver
Package driver hold implementation for action drivers.
Package driver hold implementation for action drivers.
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.
types
Package types contains launchr common types.
Package types contains launchr common types.
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL