Add godoc strings to all exported types, functions, and fields
Documents: - cli: NO_COLOR, RunOptions fields, CLIApp, VersionString - checker: Result fields, Status constants, CheckStatus fields - scanner: EnumerateStatus, ScanStatus, Options, FileEntry fields - log: Level alias, DisableStyling, Init, Info/Debug functions, verbosity helpers, GetLogger, GetLevel, WithError - mfer: ManifestScanOptions, New, NewFromPaths, NewFromFS, MAGIC
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
||||
"github.com/spf13/afero"
|
||||
)
|
||||
|
||||
// NO_COLOR disables colored output when set. Automatically true if the
|
||||
// NO_COLOR environment variable is present (per https://no-color.org/).
|
||||
var NO_COLOR bool
|
||||
|
||||
func init() {
|
||||
@@ -17,15 +19,16 @@ func init() {
|
||||
}
|
||||
|
||||
// RunOptions contains all configuration for running the CLI application.
|
||||
// Use DefaultRunOptions for standard CLI execution, or construct manually for testing.
|
||||
type RunOptions struct {
|
||||
Appname string
|
||||
Version string
|
||||
Gitrev string
|
||||
Args []string
|
||||
Stdin io.Reader
|
||||
Stdout io.Writer
|
||||
Stderr io.Writer
|
||||
Fs afero.Fs
|
||||
Appname string // Application name displayed in help and version output
|
||||
Version string // Version string (typically set at build time)
|
||||
Gitrev string // Git revision hash (typically set at build time)
|
||||
Args []string // Command-line arguments (typically os.Args)
|
||||
Stdin io.Reader // Standard input stream
|
||||
Stdout io.Writer // Standard output stream
|
||||
Stderr io.Writer // Standard error stream
|
||||
Fs afero.Fs // Filesystem abstraction for file operations
|
||||
}
|
||||
|
||||
// DefaultRunOptions returns RunOptions configured for normal CLI execution.
|
||||
|
||||
@@ -11,6 +11,8 @@ import (
|
||||
"sneak.berlin/go/mfer/internal/log"
|
||||
)
|
||||
|
||||
// CLIApp is the main CLI application container. It holds configuration,
|
||||
// I/O streams, and filesystem abstraction to enable testing and flexibility.
|
||||
type CLIApp struct {
|
||||
appname string
|
||||
version string
|
||||
@@ -19,13 +21,10 @@ type CLIApp struct {
|
||||
exitCode int
|
||||
app *cli.App
|
||||
|
||||
// I/O streams - all program input/output should go through these
|
||||
Stdin io.Reader
|
||||
Stdout io.Writer
|
||||
Stderr io.Writer
|
||||
|
||||
// Fs is the filesystem abstraction - defaults to OsFs for real filesystem
|
||||
Fs afero.Fs
|
||||
Stdin io.Reader // Standard input stream
|
||||
Stdout io.Writer // Standard output stream for normal output
|
||||
Stderr io.Writer // Standard error stream for diagnostics
|
||||
Fs afero.Fs // Filesystem abstraction for all file operations
|
||||
}
|
||||
|
||||
const banner = `
|
||||
@@ -45,6 +44,7 @@ func (mfa *CLIApp) printBanner() {
|
||||
fmt.Fprintln(mfa.Stdout, banner)
|
||||
}
|
||||
|
||||
// VersionString returns the version and git revision formatted for display.
|
||||
func (mfa *CLIApp) VersionString() string {
|
||||
return fmt.Sprintf("%s (%s)", mfa.version, mfa.gitrev)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user