cli

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: Apache-2.0 Imports: 109 Imported by: 2

Documentation

Overview

Package cli implements command-line commands for the Kopia.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type App

type App struct {
	AdvancedCommands string
	// contains filtered or unexported fields
}

App contains per-invocation flags and state of Kopia CLI.

func NewApp added in v0.9.0

func NewApp() *App

NewApp creates a new instance of App.

func (*App) AddStorageProvider added in v0.10.4

func (c *App) AddStorageProvider(p StorageProvider)

AddStorageProvider adds a new StorageProvider at runtime after the App has been initialized with the default providers. This is used in tests which require custom storage providers to simulate various edge cases.

func (*App) Attach added in v0.9.0

func (c *App) Attach(app *kingpin.Application)

Attach attaches the CLI parser to the application.

func (*App) RegisterOnExit added in v0.9.7

func (c *App) RegisterOnExit(f func())

RegisterOnExit registers the provided function to run before app exits.

func (*App) RunSubcommand added in v0.9.0

func (c *App) RunSubcommand(ctx context.Context, kpapp *kingpin.Application, argsAndFlags []string) (stdout, stderr io.Reader, wait func() error, kill func())

RunSubcommand executes the subcommand asynchronously in current process with flags in an isolated CLI environment and returns standard output and standard error.

func (*App) SetLoggerFactory added in v0.9.1

func (c *App) SetLoggerFactory(loggerForModule logging.LoggerFactory)

SetLoggerFactory sets the logger factory to be used throughout the app.

func (*App) Stderr added in v0.9.1

func (c *App) Stderr() io.Writer

Stderr returns the stderr writer.

type MaintenanceInfo added in v0.9.0

type MaintenanceInfo struct {
	maintenance.Params
	maintenance.Schedule `json:"schedule"`
}

MaintenanceInfo is used to display the maintenance info in JSON format.

type StorageFlags added in v0.10.4

type StorageFlags interface {
	Setup(sps StorageProviderServices, cmd *kingpin.CmdClause)
	Connect(ctx context.Context, isCreate bool, formatVersion int) (blob.Storage, error)
}

StorageFlags is implemented by cli storage providers which need to support a particular backend. This requires the common setup and connection methods implemented by all the cli storage providers.

type StorageProvider added in v0.10.4

type StorageProvider struct {
	Name        string
	Description string
	NewFlags    func() StorageFlags
}

StorageProvider is a CLI provider for storage options and allows the CLI to multiplex between various provider CLI flag constructors.

type StorageProviderServices added in v0.10.4

type StorageProviderServices interface {
	AddStorageProvider(p StorageProvider)
	// contains filtered or unexported methods
}

StorageProviderServices is implemented by the cli App that allows the cli and tests to mutate the default storage providers.

Source Files

Jump to

Keyboard shortcuts

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