Skip to content

print-files: --exclude argument - #507

Merged
dvolodin7 merged 2 commits into
masterfrom
print-files-no-binary
Sep 4, 2026
Merged

print-files: --exclude argument#507
dvolodin7 merged 2 commits into
masterfrom
print-files-no-binary

Conversation

@dvolodin7

@dvolodin7 dvolodin7 commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Extend the scripts/print-files.py utility so operators can exclude specific files or directories from the printed set, and so the tool dumps text sources

Key changes

  • Add a --exclude option (repeatable, action="append"). Each value is a relative file or directory path to drop from the output; a directory exclude pr
  • Add the SAFE_SUFFIXES allowlist: .py .sql .ts .json .yaml .js .conf .yml .css .sh .toml .md .html .xml .txt .j2. Files are filtered on this list both
  • Rework main onto argparse (variadic positional paths, --exclude). The default scan base is "." (relative) so that relative --exclude values m
  • Blank --exclude values are ignored (if p), so a stray empty argument no longer wipes the whole output.
  • Bump the copyright year to 2007–2026.

Notable implementation details

  • is_excluded(path) returns true when the path equals an exclude entry or has one as an ancestor, so a directory exclude prunes its subtree at every visi
  • is_safe(path) requires path.is_file() and a recognised suffix.
  • The relative default base (".") is what makes the --exclude matching reliable; an absolute base (the previous behaviour) caused relative excludes to

@dvolodin7 dvolodin7 added this to the 26.0 milestone Sep 4, 2026
@dvolodin7 dvolodin7 self-assigned this Sep 4, 2026
@dvolodin7 dvolodin7 changed the title print-files: --exclude argumnent print-files: --exclude argument Sep 4, 2026
@dvolodin7
dvolodin7 merged commit e2414da into master Sep 4, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant