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

feat: support multi inputs #179

Merged
merged 6 commits into from
Jan 21, 2022
Merged

Conversation

kenji-miyake
Copy link
Contributor

Resolves #78

This is an improved version of #178.
Although the diff is large, since I split commits into small units, I suppose you can understand what I changed by seeing each commit.

How to test

$ git clone [email protected]:kenji-miyake/markdown-link-check.git -b support-multi-inputs
$ cd markdown-link-check
$ git cherry-pick 7b3ad2c1ce5e49d03ff29cbebd6951006b0ccf4a
$ # pre-commit
$ pre-commit clean
$ pre-commit run -a
[WARNING] The 'rev' field of repo '.' appears to be a mutable reference (moving tag / branch).  Mutable references are never updated after first install and are not supported.  See https://pre-commit.com/#using-the-latest-version-for-a-repository for more details.  Hint: `pre-commit autoupdate` often fixes this.
[INFO] Initializing environment for ..
[INFO] Installing environment for ..
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
Markdown Link Check......................................................Failed
- hook id: markdown-link-check
- exit code: 1


FILE: test-2.md

  1 links checked.

FILE: test-1.md

  1 links checked.

FILE: test-3.md
  [✖] http://common-invalid-link.example.com
  [✖] http://invalid-link3.example.com

  3 links checked.

  ERROR: 2 dead links found!
  [✖] http://common-invalid-link.example.com → Status: 0
  [✖] http://invalid-link3.example.com → Status: 0

FILE: test-4.md

  1 links checked.

$ # CLI
$ sudo npm install -g .
$ markdown-link-check test-1.md test-2.md test-3.md test-4.md

FILE: test-1.md
  [✓] http://google.com

  1 links checked.

FILE: test-2.md
  [✓] http://google.com

  1 links checked.

FILE: test-3.md
  [✓] http://google.com
  [✖] http://common-invalid-link.example.com
  [✖] http://invalid-link3.example.com

  3 links checked.

  ERROR: 2 dead links found!
  [✖] http://common-invalid-link.example.com → Status: 0
  [✖] http://invalid-link3.example.com → Status: 0

FILE: test-4.md
  [✓] http://google.com

  1 links checked.

Kenji Miyake added 6 commits December 5, 2021 17:07
Signed-off-by: Kenji Miyake <[email protected]>
Signed-off-by: Kenji Miyake <[email protected]>
Signed-off-by: Kenji Miyake <[email protected]>
Signed-off-by: Kenji Miyake <[email protected]>
@kenji-miyake
Copy link
Contributor Author

@tcort Hello, thank you for this useful tool!
Could you take a look at this, please? 🙏

@kenji-miyake
Copy link
Contributor Author

@tcort Hi, I know you are busy, but let me friendly ping.

@tcort tcort merged commit da43429 into tcort:master Jan 21, 2022
@kenji-miyake kenji-miyake deleted the support-multi-inputs branch January 21, 2022 12:24
@kenji-miyake
Copy link
Contributor Author

@tcort Thank you so much! 😄

@waylan
Copy link

waylan commented Jan 21, 2022

Shouldn't the documentation be updated to reflect this change (and demonstrate how to call with multiple files)?

#### Check links from a local markdown folder (recursive)
Avoid using `find -exec` because it will swallow the error from each consecutive run.
Instead, use `xargs`:
```shell
find . -name \*.md -print0 | xargs -0 -n1 markdown-link-check
```
There is an [open issue](https://github.com/tcort/markdown-link-check/issues/78) for allowing the tool to specify
multiple files on the command line.

@matschaffer
Copy link

I had the same question as @waylan - is there a way to enable recursive check using a cli arg? I'm using the docker command to try this out for starters. --help on that doesn't seem to list any "recursive" option.

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.

Allow specifying multiple files on the command line
4 participants