Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Support globbing for --in paths #567

Open
davesmith00000 opened this issue Oct 9, 2021 · 3 comments
Open

Feature request: Support globbing for --in paths #567

davesmith00000 opened this issue Oct 9, 2021 · 3 comments

Comments

@davesmith00000
Copy link

Hello!

I'm trying to process > 50 markdown files with mdoc, and generally the experience is excellent.

These are files that were previously unchecked, that are now being checked for the first time, and getting them all up to standard is a slow process, partially because I have a lot of errors(!), but also compiling 50 files takes a long time. To speed things up a bit, I've been using the --in param to single out the file I'm currently working on.

What I'd really like (in lieu of tab completion) is to be able to glob for a file, rather than having to put in the full path (they are quite often several directories deep). For example (sbt):

This:

docs/mdoc --in docs/presentation/lighting.md

Could be something like:

docs/mdoc --in **/lighting.md
``

As you would do with `testOnly` when you want to test a single test suite. I would be quite happy with mdoc choosing the first matching file if there was more than one.
@olafurpg
Copy link
Member

Thank you for reporting! Have you tried the --include and --exclude flags?

  --include [<glob> ...] (default: [])
    Glob to filter which files to process. Defaults to all files. Example: --include
    **/example.md will process only files with the name example.md.

  --exclude [<glob> ...] (default: [])
    Glob to filter which files from exclude from processing. Defaults to no files.
    Example: --include users/**.md --exclude **/example.md will process all
    files in the users/ directory excluding files named example.md.

The --in flag must be a directory since input files get relativized by it.

@olafurpg
Copy link
Member

Also, have you tried the --watch flag? You always pay a base overhead from initializing the compiler if you run mdoc/run on every iterations. With --watch you get the fastest possible edit/preview feedback loop possible

@davesmith00000
Copy link
Author

Ah ha! Yes --include appears to do the trick!

Might be worth a note in the docs under the "process-single-markdown-file" section?

I hadn't bothered with --watch because to tell you the truth, processing a single file (with --in or --include) both throw an exception, so I foolishly assumed that --watch wouldn't work anyway... but funnily enough I've just tried it and I don't get the exception when using watch! Weird. Here's the message if you're interested (that's all of it):

Exception: sbt.TrapExitSecurityException thrown from the UncaughtExceptionHandler in thread "run-main-4"

Thanks again!

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

No branches or pull requests

2 participants