cli

package
v1.6.2 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: MIT Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Base errors
	ErrInvalidArgument = errors.New("prune requires an argument (e.g., orphans or duration like '30d')")

	// Orphans-related errors
	ErrOrphansCombination = errors.New("orphans argument cannot be combined with other arguments")

	// Duration-related errors
	ErrInvalidDuration     = errors.New("invalid duration format")
	ErrInvalidDurationNum  = errors.New("duration must be a positive number")
	ErrInvalidDurationUnit = errors.New("unsupported duration unit")
)

Functions

func Run

func Run(v Version) error

Run is the main entry point for the CLI

Types

type CLI

type CLI struct {
	// contains filtered or unexported fields
}

func (*CLI) Prune added in v1.6.0

func (c *CLI) Prune(args []string) error

Prune handles the pruning of trash contents It processes multiple subcommands for cleaning up the trash

func (*CLI) Put

func (c *CLI) Put(args []string) error

Put moves files to trash

func (*CLI) Restore

func (c *CLI) Restore() error

Restore handles the restoration of files from trash

func (CLI) Run

func (c CLI) Run(args []string) error

type MetaOption added in v1.3.0

type MetaOption struct {
	Version bool      `short:"V" long:"version" description:"Show version"`
	Debug   string    `long:"debug" description:"View debug logs" optional-value:"full" optional:"yes" choice:"full" choice:"live"`
	Prune   PruneArgs `` /* 131-byte string literal not displayed */
}

type Option

type Option struct {
	Restore bool   `short:"b" long:"restore" description:"Restore deleted file"`
	Config  string `long:"config" description:"Path to config file" default:""`

	Meta MetaOption `group:"Meta Options"`
	Rm   RmOption   `group:"Compatible (rm) Options"`
}

type OrphanedFile added in v1.6.0

type OrphanedFile struct {
	Path          string
	DeletedAt     time.Time
	OriginalPath  string
	TrashInfoPath string
	TrashInfoName string
}

OrphanedFile represents an orphaned metadata file with additional details

func (OrphanedFile) GetDeletedAt added in v1.6.0

func (o OrphanedFile) GetDeletedAt() time.Time

func (OrphanedFile) GetName added in v1.6.0

func (o OrphanedFile) GetName() string

type PruneArgs added in v1.6.0

type PruneArgs []string

func (*PruneArgs) UnmarshalFlag added in v1.6.0

func (s *PruneArgs) UnmarshalFlag(value string) error

type RmOption

type RmOption struct {
	Interactive bool `short:"i" description:"(dummy) prompt before every removal"`
	Recursive   bool `short:"r" long:"recursive" description:"(dummy) remove directories and their contents recursively"`
	Recursive2  bool `short:"R" description:"(dummy) same as -r"`
	Force       bool `short:"f" long:"force" description:"(dummy) ignore nonexistent files, never prompt"`
	Directory   bool `short:"d" long:"dir" description:"(dummy) remove empty directories"`
	Verbose     bool `short:"v" long:"verbose" description:"(dummy) explain what is being done"`
}

RmOption provides compatibility with rm command options https://man7.org/linux/man-pages/man1/rm.1.html

type Version

type Version struct {
	AppName   string
	Version   string
	Revision  string
	BuildDate string
}

func (Version) String added in v1.5.1

func (v Version) String() string

Jump to

Keyboard shortcuts

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