Skip to content

feat: add single filter syntax help to -filters flag - #97

Merged
swperb merged 2 commits into
swperb:mainfrom
lobotomia-ops:feature-filter-help
Jun 17, 2026
Merged

feat: add single filter syntax help to -filters flag#97
swperb merged 2 commits into
swperb:mainfrom
lobotomia-ops:feature-filter-help

Conversation

@lobotomia-ops

Copy link
Copy Markdown
Contributor

Closes #76. Added the ability to view the syntax for a specific filter by passing its name after the -filters flag (e.g., ./imgcli -filters gblur). If no filter name matches, it prints an error message to stderr.

lobotomia-ops and others added 2 commits June 17, 2026 14:23
Polishing the contributed per-filter help (swperb#76) before merge:

- Match the exact filter NAME, not a substring of the whole usage line. The
  substring approach matched description text too, so e.g. `-filters V` returned
  9 filters and `-filters alias` would have listed every alias.
- Return a non-zero exit (1) when no filter matches, instead of printing an
  error to stderr but exiting 0 — keeps the 0/1/2 contract intact for scripts.
- Honour --json for a single filter: emit the same [{name,syntax,description}]
  shape as `-filters --json`, filtered to the match (reusing split_usage).
- Match house style (4-space indent), and document the `-filters [NAME]` form
  in --help, the README usage block, and the man page.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@swperb
swperb merged commit 2f30d4d into swperb:main Jun 17, 2026
10 of 11 checks passed
@swperb

swperb commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Merged — thank you for tackling #76! 🎉 This is a genuinely useful addition for both humans and agents.

I pushed a few refinements onto your branch before merging so it was fully polished, all preserving your work and the Closes #76 linkage:

  • Match by exact filter name rather than a substring of the whole usage line. The substring approach also matched description text, so e.g. -filters V returned 9 filters and -filters alias would have listed every alias. Now -filters gblur → just gblur.
  • Non-zero exit on no match (1 instead of 0) so scripts/agents can tell a lookup failed — imgcli leans on its 0/1/2 exit-code contract.
  • --json support for a single filter-filters gblur --json now emits the same [{name,syntax,description}] shape as -filters --json, which is the agent-facing payoff of this feature.
  • Matched house style (4-space indent) and documented -filters [NAME] in --help, the README, and the man page.

Verified locally: clean build, 38/38 tests, and all the cases above behave correctly. Really nice contribution — the core idea was spot-on and exactly what #76 asked for. Hope to see more from you! 🙏

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.

Per-filter help: imgcli -filters <name>

2 participants