Skip to content

fix: CLI update warns on empty content + better --format position error#256

Merged
raifdmueller merged 3 commits intodocToolchain:mainfrom
raifdmueller:fix/cli-enhancements-176-250
Feb 7, 2026
Merged

fix: CLI update warns on empty content + better --format position error#256
raifdmueller merged 3 commits intodocToolchain:mainfrom
raifdmueller:fix/cli-enhancements-176-250

Conversation

@raifdmueller
Copy link
Collaborator

Summary

Changes

  • Added GlobalOptionHintCommand class that intercepts "No such option" errors for known global options and provides a helpful hint
  • Set command_class = GlobalOptionHintCommand on AliasedGroup so all subcommands benefit automatically
  • Added empty content warning (click.echo(..., err=True)) in the update command before calling service_update_section
  • Bumped version to 0.4.25

Test plan

  • 8 new tests in tests/test_cli_enhancements_176_250.py
  • Empty content warning appears on stderr
  • Whitespace-only content also triggers warning
  • Non-empty content does not trigger warning
  • Empty content still succeeds (warning only, not blocking)
  • --format after command gives helpful error mentioning global option placement
  • --format before command still works correctly
  • All 623 existing tests pass (632 total minus 9 from other in-progress PRs)

Fixes #250, Fixes #176

🤖 Generated with Claude Code

Copy link
Collaborator Author

@raifdmueller raifdmueller left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

Overall: Very good

#176 - GlobalOptionHintCommand

Elegant approach: custom click.Command subclass catches UsageError, checks if a global option was misplaced, and provides a helpful hint. Applied to all subcommands via command_class on AliasedGroup. Clean and extensible.

#250 - Empty content warning

Minimal and correct: click.echo("Warning: ...", err=True) before the update call. Warning only, doesn't block the operation.

Tests

8 tests covering both features across multiple commands. Good coverage.

Version Conflict

All 3 PRs bump to 0.4.25. Will need rebase after first merge.

Reviewed-by: R{AI}f D. Müller (AI-assisted review)

raifdmueller and others added 2 commits February 7, 2026 11:29
…or (docToolchain#250, docToolchain#176)

- Issue docToolchain#250: `update --content ""` now prints a warning to stderr
  ("Warning: Section content will be cleared.") instead of silently
  clearing the section.
- Issue docToolchain#176: When users place --format after the command (e.g.
  `dacli structure --format json`), the error message now explains
  that --format is a global option and must be placed before the
  command. Uses a GlobalOptionHintCommand class applied to all
  subcommands via AliasedGroup.command_class.
- Bump version to 0.4.25.

Fixes docToolchain#250, Fixes docToolchain#176

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…cToolchain#251)

When AsciiDoc files include each other circularly, they were reported as
"orphaned files" because the parser threw CircularIncludeError causing
documents to not load. Now detect cycles in the include graph during
index building and report them as "circular_include" errors in validation.

Fixes docToolchain#251

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@raifdmueller raifdmueller force-pushed the fix/cli-enhancements-176-250 branch from 1e257b9 to 88f33c4 Compare February 7, 2026 10:30
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@raifdmueller raifdmueller merged commit 223b7b5 into docToolchain:main Feb 7, 2026
4 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.

CLI: update command should warn when clearing section content Clearer error message for --format position

1 participant