feat: support directory arguments to open .md files inside#137
Merged
Conversation
When a directory is passed as a CLI argument, expand it to all `*.md` files directly under that directory instead of returning an error. When combined with `--watch`, the directory is converted to a watch pattern (`dir/*.md`) so new files are picked up automatically. Closes #134
This comment has been minimized.
This comment has been minimized.
hasNonDirArgs now skips paths that don't exist or can't be stat'd, so the mutual exclusion error is only raised for actual file args. Non-existent paths get a proper "file not found" from resolveArgs.
This comment has been minimized.
This comment has been minimized.
- Distinguish os.ErrNotExist from other stat errors (e.g. permission denied) to provide accurate diagnostics. - Filter out directory entries from filepath.Glob results to avoid confusing failures when a subdirectory matches *.md.
Contributor
Code Metrics Report
Details | | main (738858d) | #137 (5217a0a) | +/- |
|---------------------|----------------|----------------|-------|
+ | Coverage | 56.3% | 57.1% | +0.8% |
| Files | 39 | 39 | 0 |
| Lines | 3219 | 3256 | +37 |
+ | Covered | 1814 | 1861 | +47 |
+ | Code to Test Ratio | 1:0.5 | 1:0.5 | +0.0 |
| Code | 5014 | 5014 | 0 |
+ | Test | 2679 | 2846 | +167 |
| Test Execution Time | 29s | 29s | 0s |Code coverage of files in pull request scope (24.6% → 28.7%)
Reported by octocov |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
*.mdfiles directly under that directory instead of returning an error--watch, the directory is converted to a watch pattern (dir/*.md) so new files are picked up automatically.mdfiles) return an error when used without--watch; with--watch, the pattern is registered to watch for future filesCloses #134