Configuration¶
findfmt supports flexible, structured configuration loading through standard TOML files. This enables
setting persistent personal defaults or project-level standards for output formatting, visual styling,
traversal boundaries, and tag filtering.
1. Configuration Resolution Hierarchy¶
When findfmt executes, it determines effective settings according to a strict six-tier hierarchy where
higher-priority sources override lower-priority sources:
Explicit CLI arguments and flags (Highest Priority): Direct options passed on the command line (e.g.
--format table,--no-hidden,-t python) always override environment variables and file settings.Environment Variables:
FINDFMT_<KEY>schema environment variables (e.g.FINDFMT_FORMAT,FINDFMT_MAX_DEPTH,FINDFMT_HIDDEN,FINDFMT_TAGS) and system environment settings (NO_COLOR,CLICOLOR,CLICOLOR_FORCE,LANGUAGE,LC_*) override configuration file defaults while yielding to explicit command-line flags.Explicit Configuration File: A custom configuration path specified via
--config <path>or theFINDFMT_CONFIGenvironment variable.Project Local Configuration: A
.findfmt.tomlfile or apyproject.tomlfile containing a[tool.findfmt]table, discovered by walking up from the current working directory to the repository VCS root (.git,.hg, or.svn), or checked in the current working directory when outside a repository.Standard User Configuration Path: User-level configuration located at
$XDG_CONFIG_HOME/findfmt/config.toml(or~/.config/findfmt/config.tomlon POSIX systems;%APPDATA%\findfmt\config.tomlon Windows). When both user and project configurations exist, they are merged with project settings overriding user settings (user < project < env < CLI).Built-in Defaults (Lowest Priority): Factory default options (
format = "text",color = "auto",pager = "auto", etc.).
Note
Passing --no-config on the command line or setting FINDFMT_CONFIG="" completely
suppresses discovery and loading of TOML configuration files, while FINDFMT_<KEY> environment
variables and explicit command-line flags continue to apply.
2. Configuration Inspection¶
To inspect the currently active configuration file and resolved settings:
findfmt --show-config
When custom options are active, findfmt outputs the active path and the effective configuration table,
annotating each setting with an inline comment indicating its value provenance (default, config,
user config, project config, env, or cli):
Active configuration: /home/user/.config/findfmt/config.toml
[tool.findfmt]
color = "always" # config
format = "table" # env
hidden = true # cli
table_style = "rounded" # config
To view configuration status as part of general system diagnostics:
findfmt --diagnostics
To generate a self-documenting, annotated reference configuration file directly from the CLI:
mkdir -p ~/.config/findfmt
findfmt --generate-config > ~/.config/findfmt/config.toml
The repository and source distribution also include a practical sample configuration at examples/config.toml
and the full annotated reference template at examples/config.reference.toml.
3. Configuration File Formats¶
findfmt natively parses configuration using standard TOML. Configuration can be defined either in a
standalone config.toml file or embedded inside a repository’s pyproject.toml.
3.1. Standalone config.toml¶
A standalone file can place options at top level or under a [tool.findfmt] table:
# ~/.config/findfmt/config.toml
# Default output serialization format (text, table, tree, json, etc.)
format = "table"
# Border style for table and tree formatters (rounded, grid, ascii, etc.)
table_style = "rounded"
# ANSI color policy: "auto", "always", or "never"
color = "auto"
# Terminal pager policy: "auto", "always", or "never"
pager = "auto"
# Include hidden files (dotfiles) by default
hidden = false
# Honor .gitignore and global gitignore files (true) or ignore them (false)
ignore = true
# Default tags to include
tags = ["python", "shell"]
# Maximum directory descent depth
max_depth = 5
# Group directories first
dirs_first = true
3.2. Project Configuration (.findfmt.toml and pyproject.toml)¶
In repositories managed by modern Python tooling (uv, hatch, flit, poetry), findfmt searches upward
from the current working directory to the repository VCS root (.git, .hg, or .svn) for a standalone
.findfmt.toml file or a pyproject.toml file containing a [tool.findfmt] table:
# pyproject.toml
[tool.findfmt]
format = "tree"
table_style = "rounded"
tags = ["python"]
exclude_tags = ["text"]
ignore = true
hidden = false
dirs_first = true
3.3. Environment Variables (FINDFMT_<KEY>)¶
Every schema key in the reference table below can also be configured via an uppercase FINDFMT_<KEY>
environment variable. Environment variables override TOML configuration files and are overridden by explicit
CLI flags:
export FINDFMT_FORMAT="table"
export FINDFMT_MAX_DEPTH="2"
export FINDFMT_HIDDEN="true"
export FINDFMT_TAGS="python,shell"
Environment variable values are coerced and validated against the configuration schema:
Boolean Values: Case-insensitive
1,true,yes, oron(true), and0,false,no, oroff(false).Integers: Non-negative base-10 integers (e.g.
0,1,100).String Lists: Comma-separated items (e.g.
python,shell) or TOML/JSON array syntax (e.g.["python", "shell"]).Empty Values: Setting
FINDFMT_<KEY>=""is treated as unset and ignored.Validation: Unrecognized
FINDFMT_*keys (other thanFINDFMT_CONFIGandFINDFMT_CONTAINER_TESTS) or invalid values exit with code2and a descriptive error message.
4. Configuration Schema Reference¶
Setting |
Type |
CLI Equivalent |
Description |
Default |
|---|---|---|---|---|
|
string |
|
Output serialization format ( |
|
|
string |
|
Render output as an HTML5 document with hyperlinks prefixed by |
|
|
string |
|
Document |
|
|
bool |
|
Suppress hyperlink anchors in HTML output, rendering plain text paths. |
|
|
bool |
|
Prefix formula triggers in CSV/TSV cells with single quote to prevent spreadsheet formula injection. |
|
|
bool |
|
Allow |
|
|
string |
|
Table border style ( |
|
|
bool |
|
Omit branch indentation lines in tree format and strip extraneous whitespace in structured formats. |
|
|
bool |
|
Use ANSI/VT100 line drawing escapes for tree indentation lines. |
|
|
bool |
|
Use CP437 console graphics characters for tree indentation lines. |
|
|
string / bool |
|
Color policy: |
|
|
string / bool |
|
Terminal paging policy: |
|
|
bool |
|
Include dotfiles and hidden directories in traversal. |
|
|
bool |
|
Respect |
|
|
string |
|
External |
|
|
list[str] / str |
|
Default tag inclusions. |
|
|
list[str] / str |
|
Default tag exclusions. |
|
|
bool |
|
Require all specified tags to match rather than any tag. |
|
|
string |
|
Sort key criterion ( |
|
|
bool |
|
Yield entries in raw filesystem order without sorting (equivalent to |
|
|
bool |
|
Reverse sort ordering. |
|
|
bool |
|
Group directories before files. |
|
|
bool |
|
Group files before directories. |
|
|
bool |
|
Follow symbolic links during traversal and classify target contents (by default, symlinks are listed as link entries without following). |
|
|
bool |
|
Emit directories only and suppress files. |
|
|
bool |
|
Confine traversal to the starting directory’s filesystem device. |
|
|
int |
|
Maximum directory descent depth limit. |
|
|
int |
|
Directory entry count threshold. |
|
|
bool |
|
Omit directories containing zero matching items. |
|
|
list[str] / str |
|
Wildcard filename include patterns. |
|
|
list[str] / str |
|
Wildcard filename exclude patterns. |
|
|
bool |
|
Case-insensitive pattern matching. |
|
|
bool |
|
Inherit pattern matches to subdirectories. |
|
|
string |
|
Interpreter shebang pattern filter. |
|
|
bool |
|
Output absolute paths instead of relative paths. |
|
|
bool |
|
Prepend search prefix to relative paths. |
|
|
bool |
|
Delimit paths with NUL ( |
|
|
bool |
|
Display detected format and content tags. |
|
|
bool |
|
Print match count statistics to stderr. |
|
|
bool |
|
Exit with code 1 if no matching files are found. |
|
|
bool |
|
Format file permissions in |
|
|
bool |
|
Display file owner username or UID. |
|
|
bool |
|
Display file group name or GID. |
|
|
bool |
|
Print filesystem inode number ( |
|
|
bool |
|
Print filesystem device number ( |
|
|
bool |
|
Print file size in bytes. |
|
|
bool |
|
Format file sizes using binary units (KiB, MiB). |
|
|
bool |
|
Format file sizes using SI metric units (kB, MB). |
|
|
bool |
|
Accumulate recursive directory disk usage. |
|
|
bool |
|
Display file last modification date and time. |
|
|
bool |
|
Display last file status change date and time. |
|
|
string |
|
Custom strftime syntax format string. |
|
|
bool |
|
Append file type indicators ( |
|
|
bool |
|
Replace non-printable control characters in filenames with |
|
|
bool |
|
Print non-printable control characters literally without masking. |
|
|
bool |
|
Enclose filenames in double quotes. |
|
|
bool |
|
Render paths as OSC 8 terminal hyperlinks. |
|
|
string |
|
URI schema prefix for terminal hyperlinks. |
|
|
string |
|
Authority or hostname component for terminal hyperlinks. |
|
|
string |
|
Default display and translation locale. |
|
Note
The legacy tree, json, and xml boolean configuration keys (and their FINDFMT_TREE,
FINDFMT_JSON, and FINDFMT_XML environment counterparts) emit a deprecation warning in 1.x and
will be removed in v2.0.0. Use format = "tree", format = "json", or format = "xml" (or
FINDFMT_FORMAT) instead.
5. Troubleshooting & Diagnostics¶
Syntax Errors: If a configuration file contains invalid TOML syntax,
findfmtdisplays an informative syntax error and exits with code2:Error: Invalid TOML in configuration file '/home/user/.config/findfmt/config.toml': Expected '=' after a key in a key/value pair (at line 4, column 1)
Unknown Keys: If an unsupported or misspelled key is provided,
findfmtrejects the configuration:Error: Unknown configuration key 'frmat' in '/home/user/.config/findfmt/config.toml'.
Type Mismatches: Supplying an unexpected type (e.g., a string where a boolean is required) triggers a clear validation error:
Error: Invalid value for 'hidden' in '/home/user/.config/findfmt/config.toml': expected boolean (true/false), got str
Bypassing Configuration: In scripts or CI environments where deterministic, clean-room behavior is required regardless of existing user configurations, supply
--no-config:findfmt --no-config -t python