entry

package
v0.0.0-...-4efa062 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package entry provides functionality for listing directory entries with customizable formatting and cross-platform support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseFlags

func ParseFlags() (*flag.FlagSet, error)

ParseFlags parses command-line flags and returns the configuration.

func PrintEntries

func PrintEntries(path string) error

PrintEntries prints entries to stdout and, if cfg.Recurse is true, recurses into subdirectories.

func ResolvePath

func ResolvePath(f *flag.FlagSet) (string, error)

ResolvePath returns the first non-flag argument as a cleaned path, or "." if none is provided. It returns an error if the path is inaccessible.

Types

type Config

type Config struct {
	All         bool
	Grid        bool
	Long        bool
	Header      bool
	Recurse     bool
	Tree        bool
	Classify    bool
	Dereference bool
	Size        bool
	Time        bool
	Kind        bool
	Ext         bool
	Reverse     bool
	NoColor     bool
	NoSort      bool
}

Config holds command-line configuration options for directory listing.

type Entry

type Entry struct {
	os.FileInfo
	// contains filtered or unexported fields
}

Entry represents a file or directory with its metadata. It embeds os.FileInfo to provide direct access to file information methods (Size, ModTime, IsDir, etc).

func (Entry) Classify

func (e Entry) Classify() (string, string)

Classify classifies an entry and returns its type identifier and display symbol. Returns two strings: (typeIdentifier, displaySymbol)

func (Entry) DisplayName

func (e Entry) DisplayName() string

DisplayName formats the basename of an entry and returns the formatted string.

func (Entry) IsHidden

func (e Entry) IsHidden() bool

IsHidden reports whether a file is hidden by its name starting with a dot. Returns false for empty filenames to avoid potential panics.

Jump to

Keyboard shortcuts

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