Skip to content

Conversation

@kompre
Copy link
Owner

@kompre kompre commented Dec 1, 2025

Summary

Changes CLI behavior to exit with code 0 instead of 1 when no files are found to process. This treats "no work to do" as a valid state rather than an error condition.

Changes

  • quarto_batch_convert.py (lines 301-303, 321-326)

    • Replace ctx.exit(1) with return for graceful exit
    • Remove "Error:" prefix from messages
  • test_quarto_batch_convert.py (test_no_match_found)

    • Update to expect exit code 0 instead of 1
    • Update docstring to reflect graceful behavior

Rationale

  • No files to process is not an error - it's a valid state where there's no work to do
  • Prevents failure of CI/CD pipelines and automated scripts when no matching files exist
  • Consistent with Unix tools (grep, find) that exit 0 on no matches

Testing

✅ All 17 tests pass

  • test_no_match_found now validates exit code 0
  • All other tests remain passing

Test Scenarios Covered

  1. Empty directory with -r flag
  2. Directory with files but wrong extension
  3. Regex pattern that matches no files
  4. Non-existent glob pattern

All scenarios now exit with code 0 and informative (non-error) message.

🤖 Generated with Claude Code

kompre and others added 3 commits December 1, 2025 10:32
Add task proposal to handle "no files found" scenarios gracefully.
Currently CLI exits with error code 1 when no files are found.
Proposal suggests exiting with code 0 since no work to do is not an error.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Changed CLI behavior to exit with code 0 instead of 1 when no files
are found to process. This treats "no work to do" as a valid state
rather than an error condition.

Changes:
- Remove "Error:" prefix from "no files found" messages
- Replace ctx.exit(1) with return for graceful exit
- Update test_no_match_found to expect exit code 0
- Update test docstring to reflect graceful exit behavior

Rationale:
- No files to process is not an error - it's a valid state
- Prevents failure of CI/CD pipelines and automated scripts
- Consistent with Unix tools (grep, find) that exit 0 on no matches

All 17 tests pass.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@kompre kompre added release Publish package to PyPI bump:patch Version bump: patch labels Dec 1, 2025
@kompre kompre removed the bump:patch Version bump: patch label Dec 1, 2025
@kompre kompre merged commit b0b07a4 into main Dec 1, 2025
1 check passed
@kompre kompre deleted the fix/graceful-no-files-exit branch December 1, 2025 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release Publish package to PyPI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants