cli

package
v0.18.2 Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2024 License: Apache-2.0 Imports: 140 Imported by: 2

Documentation

Overview

Package cli implements command-line commands for the Kopia.

Index

Constants

View Source
const DirMode = 0o700

DirMode is the directory mode for output directories.

Variables

This section is empty.

Functions

func CheckIndexInfo added in v0.13.0

func CheckIndexInfo(i0, i1 content.Info) []string

CheckIndexInfo compare two index infos. If a mismatch exists, return an error with diagnostic information.

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) EnvName added in v0.11.3

func (c *App) EnvName(n string) string

EnvName overrides the provided environment variable name for testability.

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, stdin io.Reader, argsAndFlags []string) (stdout, stderr io.Reader, wait func() error, interrupt func(os.Signal))

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

func (*App) SetEnvNamePrefixForTesting added in v0.11.3

func (c *App) SetEnvNamePrefixForTesting(prefix string)

SetEnvNamePrefixForTesting sets the name prefix to be used for all environment variable names for testing.

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) SetRestoreProgress added in v0.18.0

func (c *App) SetRestoreProgress(p RestoreProgress)

SetRestoreProgress is used to set custom restore progress, purposed to be used in tests.

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 RepositoryStatus added in v0.10.7

type RepositoryStatus struct {
	ConfigFile  string `json:"configFile"`
	UniqueIDHex string `json:"uniqueIDHex"`

	ClientOptions repo.ClientOptions              `json:"clientOptions"`
	Storage       blob.ConnectionInfo             `json:"storage"`
	Capacity      *blob.Capacity                  `json:"volume,omitempty"`
	ContentFormat format.ContentFormat            `json:"contentFormat"`
	ObjectFormat  format.ObjectFormat             `json:"objectFormat"`
	BlobRetention format.BlobStorageConfiguration `json:"blobRetention"`
}

RepositoryStatus is used to display the repository info in JSON format.

type RestoreProgress added in v0.18.0

type RestoreProgress interface {
	SetCounters(s restore.Stats)
	Flush()
}

RestoreProgress is invoked to report progress during a restore.

type SnapshotManifest added in v0.11.0

type SnapshotManifest struct {
	*snapshot.Manifest
	RetentionReasons []string `json:"retentionReason,omitempty"`
}

SnapshotManifest defines the JSON output for the CLI snapshot commands.

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 {
	EnvName(s string) string
	// 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