cmdargs

package
v0.0.0-...-cd9b5d8 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arguments

type Arguments struct {
	ListTargets *ListTargetsCmd `arg:"subcommand:list-targets"`
	Initialise  *InitialiseCmd  `arg:"subcommand:init"`
	Info        *InfoCmd        `arg:"subcommand:info"`
	List        *ListCmd        `arg:"subcommand:list"`
	Create      *CreateCmd      `arg:"subcommand:create"`
	ExportKey   *ExportKeyCmd   `arg:"subcommand:export-key"`
	ImportKey   *ImportKeyCmd   `arg:"subcommand:import-key"`
	Clean       *CleanCmd       `arg:"subcommand:clean"`

	ConfigFile string `arg:"-c,--config-file"`
}

Arguments struct defines the CLI Interface

func ParseArgs

func ParseArgs() *Arguments

ParseArgs is the main function used to initiate CLI argument parsing

func (*Arguments) RunSubcommand

func (args *Arguments) RunSubcommand(cfg config.Config) int

RunSubCommand method finds the CLI subcommand specified and calls it's Run() method

type BorgTarget

type BorgTarget struct {
	Archive string
	Store   string
}

BorgTarget holds the ARCHIVE:REPO target specified as CLI argument

func (*BorgTarget) UnmarshalText

func (t *BorgTarget) UnmarshalText(b []byte) error

UnmarshalText parses the ARCHIVE:REPO bytestring into BorgTarget fields

type CleanCmd

type CleanCmd struct{}

clean ----------------------------------------------------------------------------

func (CleanCmd) Run

func (cmd CleanCmd) Run(cfg config.Config) int

type CreateCmd

type CreateCmd struct {
	Target BorgTarget `arg:"required,positional"`
}

create ----------------------------------------------------------------------------

func (CreateCmd) Run

func (cmd CreateCmd) Run(cfg config.Config) int

type ExportKeyCmd

type ExportKeyCmd struct {
	Target BorgTarget `arg:"required,positional"`
}

export-key ----------------------------------------------------------------------------

func (ExportKeyCmd) Run

func (cmd ExportKeyCmd) Run(cfg config.Config) int

type ImportKeyCmd

type ImportKeyCmd struct {
	Target       SingleBorgTarget `arg:"required,positional"`
	Keyfile      string           `arg:"required"`
	PasswordFile string           `arg:"--password-file"`
}

import-key ----------------------------------------------------------------------------

func (ImportKeyCmd) Run

func (cmd ImportKeyCmd) Run(cfg config.Config) int

type InfoCmd

type InfoCmd struct {
	Target BorgTarget `arg:"required,positional"`
}

info ----------------------------------------------------------------------------

func (InfoCmd) Run

func (cmd InfoCmd) Run(cfg config.Config) int

type InitialiseCmd

type InitialiseCmd struct {
	Target BorgTarget `arg:"required,positional"`
}

initialise ----------------------------------------------------------------------------

func (InitialiseCmd) Run

func (cmd InitialiseCmd) Run(cfg config.Config) int

type ListCmd

type ListCmd struct {
	Target BorgTarget `arg:"required,positional"`
}

list ----------------------------------------------------------------------------

func (ListCmd) Run

func (cmd ListCmd) Run(cfg config.Config) int

type ListTargetsCmd

type ListTargetsCmd struct {
	Format string `arg:"-F,--format" default:"text"`
}

list-targets ----------------------------------------------------------------------------

func (ListTargetsCmd) Run

func (cmd ListTargetsCmd) Run(cfg config.Config) int

type RunnableCommand

type RunnableCommand interface {
	Run(cfg config.Config) int
}

RunnableCommand is the interface which all subcommands implement. This allows all subcommands to have a .Run() method with a consistent signature. Subcommand-specific args are passed into the real command function by their respective implementations

type SingleBorgTarget

type SingleBorgTarget BorgTarget

SingleBorgTarget is the same as BorgTarget except fails during Unmarshal if any field is unset

func (*SingleBorgTarget) UnmarshalText

func (t *SingleBorgTarget) UnmarshalText(b []byte) error

Jump to

Keyboard shortcuts

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