app

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package app

Index

Constants

This section is empty.

Variables

View Source
var Version = ""

Functions

This section is empty.

Types

type App

type App struct {
	Config   *Config
	Writer   io.Writer
	ExitCode model.ExitCode
	Logger   *log.Logger
}

App represents the main application that holds configuration, a writer, exit codes, and a logger.

func (*App) Exit

func (a *App) Exit()

Exit terminates the program with the current stored exit code.

func (*App) GetArguments

func (a *App) GetArguments() *Args

GetArguments parses the configured file list and categorizes them as files or directories. It also sets an error exit code for entries that are not accessible.

func (*App) PrintDirectory

func (a *App) PrintDirectory(d *model.Directory)

Sorts the directory's files according to the app config and prints them.

func (*App) ProcessDirectory

func (a *App) ProcessDirectory(d *model.DirectoryEntry) (*model.Directory, error)

Reads the contents of the given directory, builds a *model.Directory that contains *model.Entry objects for each item, and returns it.

func (*App) ProcessFiles

func (a *App) ProcessFiles(files []model.FileEntry) *model.Directory

Converts a slice of file entries into a *model.Directory for printing.

func (*App) Run

func (a *App) Run()

Run is the main entry point that orchestrates listing files/directories and printing results.

func (*App) Write

func (a *App) Write(buf *bytes.Buffer)

Write copies a buffer to the App's writer, panicking on error.

type Args

type Args struct {
	Files []model.FileEntry
	Dirs  []model.DirectoryEntry
}

Args stores the parsed command-line arguments as separate files and directories.

type Config

type Config struct {
	FileList        []string
	AllMode         model.Include
	SortMode        model.SortMode
	LongListingMode model.Listing
	TimeFormatter   format.Timestamp
	Recursive       bool
	GitStatus       bool
	Reverse         bool
	DisableIcon     bool
	OneFilePerLine  bool
	Directory       bool
	NoGroup         bool
	HumanReadable   bool
	ShowBlockSize   bool
	ShowInodeNumber bool
}

func GetConfigFromCli

func GetConfigFromCli() *Config

func NewConfig

func NewConfig() *Config

type Flag added in v1.4.1

type Flag struct {
	Short       rune
	Long        string
	Description string
	Type        FlagType
	Value       interface{}
}

type FlagType added in v1.4.1

type FlagType int
const (
	FlagBool FlagType = iota
)

type Parser added in v1.4.1

type Parser struct {
	Flags      []*Flag
	Args       []string
	Usage      string
	Parameters string
}

func NewParser added in v1.4.1

func NewParser() *Parser

func (*Parser) Bool added in v1.4.1

func (p *Parser) Bool(short rune, long string, description string) *bool

func (*Parser) Parse added in v1.4.1

func (p *Parser) Parse(args []string) error

func (*Parser) PrintUsage added in v1.4.1

func (p *Parser) PrintUsage()

type RecursiveLookupFrame

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

Jump to

Keyboard shortcuts

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