Documentation
¶
Index ¶
- Constants
- Variables
- func PrintNerdStats(stats nerdstats.NerdStats, context string)
- func PrintRunSummary(rs RunSummary, flags *Flags)
- func PrintVersionInfo(extendedInfo bool)
- func SummariseSmashedFile(stats slicer.SlicerStats, ffs *indexer.FileFS, ms int64, ...)
- type App
- type AppRuntime
- type AppSession
- type CICapabilities
- type DuplicateFiles
- type EmptyFiles
- type EnvironmentInfo
- type File
- type Flags
- type NoOpSpinner
- type OutputConfig
- type OutputManager
- func (om *OutputManager) IsSilent() bool
- func (om *OutputManager) IsVerbose() bool
- func (om *OutputManager) Print(a ...interface{})
- func (om *OutputManager) Printf(format string, a ...interface{})
- func (om *OutputManager) Println(a ...interface{})
- func (om *OutputManager) ShouldGenerateReport() bool
- func (om *OutputManager) ShouldShowProgress() bool
- func (om *OutputManager) StartSpinner(spinner pterm.SpinnerPrinter, text string, writer ...*pterm.MultiPrinter) SpinnerHandle
- func (om *OutputManager) VerbosePrint(a ...interface{})
- func (om *OutputManager) VerbosePrintf(format string, a ...interface{})
- func (om *OutputManager) VerbosePrintln(a ...interface{})
- type ReportDuplicateSummary
- type ReportFailSummary
- type ReportFileBaseSummary
- type ReportFileSummary
- type ReportFiles
- type ReportMeta
- type ReportOutput
- type ReportSummary
- type ReportTopFilesSummary
- type RunSummary
- type SpinnerHandle
Constants ¶
const ( TreeNextChild = "├─" TreeLastChild = "└─" )
const ( GithubHomeText = "github.com/thushan/smash" GithubHomeUri = "https://github.com/thushan/smash" GithubLatestUri = "https://github.com/thushan/smash/releases/latest" )
const ReportOutputTemplate = "report-*.json"
Variables ¶
var ( Version = "v1.0.0" Commit = "none" Date = "unknown" Time = "nowish" User = "local" )
Functions ¶
func PrintNerdStats ¶ added in v0.0.7
func PrintRunSummary ¶ added in v0.0.7
func PrintRunSummary(rs RunSummary, flags *Flags)
func PrintVersionInfo ¶
func PrintVersionInfo(extendedInfo bool)
func SummariseSmashedFile ¶ added in v0.0.7
func SummariseSmashedFile(stats slicer.SlicerStats, ffs *indexer.FileFS, ms int64, duplicates *xsync.Map[string, *DuplicateFiles], empty *EmptyFiles)
Types ¶
type App ¶
type App struct {
Flags *Flags
Session *AppSession
Runtime *AppRuntime
Summary *RunSummary
Output *OutputManager
Args []string
Locations []indexer.LocationFS
}
func (*App) ExportReport ¶ added in v0.0.7
func (app *App) ExportReport()
func (*App) GenerateReportOutput ¶ added in v0.0.7
func (app *App) GenerateReportOutput() ReportOutput
func (*App) PrintRunAnalysis ¶ added in v0.0.4
type AppRuntime ¶ added in v0.0.4
type AppSession ¶ added in v0.0.3
type CICapabilities ¶ added in v1.0.0
CICapabilities describes what a CI environment supports
func GetCICapabilities ¶ added in v1.0.0
func GetCICapabilities() CICapabilities
GetCICapabilities returns the capabilities of the current CI environment
type DuplicateFiles ¶ added in v0.0.7
type EmptyFiles ¶ added in v0.0.7
type EnvironmentInfo ¶ added in v1.0.0
type EnvironmentInfo struct {
TermType string
IsTerminal bool
IsCI bool
IsTesting bool
IsContainer bool
ForceColor bool
NoColor bool
ShouldAnimate bool
}
EnvironmentInfo contains information about the execution environment
func DetectEnvironment ¶ added in v1.0.0
func DetectEnvironment() EnvironmentInfo
DetectEnvironment analyzes the current execution environment
type Flags ¶
type Flags struct {
OutputFile string `yaml:"output"`
Base []string `yaml:"base"`
ExcludeDir []string `yaml:"exclude-dir"`
ExcludeFile []string `yaml:"exclude-file"`
MinSize int64 `yaml:"min-size"`
MaxSize int64 `yaml:"max-size"`
SliceThreshold int64 `yaml:"slice-threshold"`
SliceSize int64 `yaml:"slice-size"`
Slices int `yaml:"slices"`
Algorithm int `yaml:"algorithm"`
MaxThreads int `yaml:"max-threads"`
MaxWorkers int `yaml:"max-workers"`
ProgressUpdate int `yaml:"progress-update"`
ShowTop int `yaml:"show-top"`
DisableSlicing bool `yaml:"disable-slicing"`
DisableMeta bool `yaml:"disable-meta"`
DisableAutoText bool `yaml:"disable-autotext"`
IgnoreEmpty bool `yaml:"ignore-empty"`
IgnoreHidden bool `yaml:"ignore-hidden"`
IgnoreSystem bool `yaml:"ignore-system"`
ShowVersion bool `yaml:"version"`
ShowNerdStats bool `yaml:"nerd-stats"`
Recurse bool `yaml:"recurse"`
ShowDuplicates bool `yaml:"show-duplicates"`
Silent bool `yaml:"silent"`
HideTopList bool `yaml:"no-top-list"`
HideProgress bool `yaml:"no-progress"`
HideOutput bool `yaml:"no-output"`
Profile bool `yaml:"profile"`
Verbose bool `yaml:"verbose"`
}
type NoOpSpinner ¶ added in v1.0.0
type NoOpSpinner struct{}
NoOpSpinner is a spinner that does nothing (for silent/non-TTY modes)
func (*NoOpSpinner) Fail ¶ added in v1.0.0
func (n *NoOpSpinner) Fail(text string)
func (*NoOpSpinner) Stop ¶ added in v1.0.0
func (n *NoOpSpinner) Stop() error
func (*NoOpSpinner) Success ¶ added in v1.0.0
func (n *NoOpSpinner) Success(text string)
func (*NoOpSpinner) UpdateText ¶ added in v1.0.0
func (n *NoOpSpinner) UpdateText(text string)
func (*NoOpSpinner) Warning ¶ added in v1.0.0
func (n *NoOpSpinner) Warning(text string)
type OutputConfig ¶ added in v1.0.0
type OutputConfig struct {
Silent bool
ShowProgress bool
UseColor bool
Verbose bool
GenerateReport bool
}
OutputConfig contains the resolved output configuration
type OutputManager ¶ added in v1.0.0
type OutputManager struct {
// contains filtered or unexported fields
}
OutputManager handles all output operations respecting environment and flags
func NewOutputManager ¶ added in v1.0.0
func NewOutputManager(flags *Flags) *OutputManager
NewOutputManager creates a new output manager based on flags and environment
func (*OutputManager) IsSilent ¶ added in v1.0.0
func (om *OutputManager) IsSilent() bool
IsSilent returns true if silent mode is enabled
func (*OutputManager) IsVerbose ¶ added in v1.0.0
func (om *OutputManager) IsVerbose() bool
IsVerbose returns true if verbose output is enabled
func (*OutputManager) Print ¶ added in v1.0.0
func (om *OutputManager) Print(a ...interface{})
Print outputs a message if not in silent mode
func (*OutputManager) Printf ¶ added in v1.0.0
func (om *OutputManager) Printf(format string, a ...interface{})
Printf outputs a formatted message if not in silent mode
func (*OutputManager) Println ¶ added in v1.0.0
func (om *OutputManager) Println(a ...interface{})
Println outputs a message with newline if not in silent mode
func (*OutputManager) ShouldGenerateReport ¶ added in v1.0.0
func (om *OutputManager) ShouldGenerateReport() bool
ShouldGenerateReport returns true if report should be generated
func (*OutputManager) ShouldShowProgress ¶ added in v1.0.0
func (om *OutputManager) ShouldShowProgress() bool
ShouldShowProgress returns true if progress indicators should be shown
func (*OutputManager) StartSpinner ¶ added in v1.0.0
func (om *OutputManager) StartSpinner(spinner pterm.SpinnerPrinter, text string, writer ...*pterm.MultiPrinter) SpinnerHandle
StartSpinner creates and starts a spinner if appropriate for the environment
func (*OutputManager) VerbosePrint ¶ added in v1.0.0
func (om *OutputManager) VerbosePrint(a ...interface{})
VerbosePrint outputs a message only in verbose mode
func (*OutputManager) VerbosePrintf ¶ added in v1.0.0
func (om *OutputManager) VerbosePrintf(format string, a ...interface{})
VerbosePrintf outputs a formatted message only in verbose mode
func (*OutputManager) VerbosePrintln ¶ added in v1.0.0
func (om *OutputManager) VerbosePrintln(a ...interface{})
VerbosePrintln outputs a message with newline only in verbose mode
type ReportDuplicateSummary ¶ added in v0.0.7
type ReportDuplicateSummary struct {
Duplicates []ReportFileSummary `json:"duplicates"`
ReportFileSummary
}
type ReportFailSummary ¶ added in v0.0.7
type ReportFileBaseSummary ¶ added in v0.0.7
type ReportFileSummary ¶ added in v0.0.7
type ReportFileSummary struct {
ReportFileBaseSummary
Hash string `json:"hash"`
Size uint64 `json:"size"`
FullHash bool `json:"fullHash"`
}
type ReportFiles ¶ added in v0.0.7
type ReportFiles struct {
Fails []ReportFailSummary `json:"fails"`
Empty []ReportFileBaseSummary `json:"empty"`
Dupes []ReportDuplicateSummary `json:"dupes"`
}
type ReportMeta ¶ added in v0.0.7
type ReportOutput ¶ added in v0.0.7
type ReportOutput struct {
Meta ReportMeta `json:"_meta"`
Analysis ReportFiles `json:"analysis"`
Summary ReportSummary `json:"summary"`
}
type ReportSummary ¶ added in v0.0.7
type ReportSummary struct {
TopFiles []ReportTopFilesSummary `json:"top"`
DuplicateFileSize uint64 `json:"duplicateFileSize"`
TotalFiles int64 `json:"totalFiles"`
TotalFileErrors int64 `json:"totalFileFails"`
ElapsedTime int64 `json:"elapsedTime"`
UniqueFiles int64 `json:"uniqueFiles"`
EmptyFiles int64 `json:"emptyFiles"`
DuplicateFiles int64 `json:"duplicateFiles"`
}