Skip to content

Commit

Permalink
docs: Add npx to linkinator commands for consistency (#543)
Browse files Browse the repository at this point in the history
Co-authored-by: Justin Beckwith <[email protected]>
  • Loading branch information
hrittikhere and JustinBeckwith authored Jun 2, 2024
1 parent 2ce7188 commit 30eedaf
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,25 +127,25 @@ npx linkinator ./docs --skip www.googleapis.com
The `--skip` parameter will accept any regex! You can do more complex matching, or even tell it to only scan links with a given domain:

```sh
linkinator http://jbeckwith.com --skip '^(?!http://jbeckwith.com)'
npx linkinator http://jbeckwith.com --skip '^(?!http://jbeckwith.com)'
```

Maybe you're going to pipe the output to another program. Use the `--format` option to get JSON or CSV!

```sh
linkinator ./docs --format CSV
npx linkinator ./docs --format CSV
```

Let's make sure the `README.md` in our repo doesn't have any busted links:

```sh
linkinator ./README.md --markdown
npx linkinator ./README.md --markdown
```

You know what, we better check all of the markdown files!

```sh
linkinator "**/*.md" --markdown
npx linkinator "**/*.md" --markdown
```

### Configuration file
Expand Down Expand Up @@ -179,7 +179,7 @@ All options are optional. It should look like this:
To load config settings outside the CWD, you can pass the `--config` flag to the `linkinator` CLI:

```sh
linkinator --config /some/path/your-config.json
npx linkinator --config /some/path/your-config.json
```

## GitHub Actions
Expand Down Expand Up @@ -341,7 +341,7 @@ This library supports proxies via the `HTTP_PROXY` and `HTTPS_PROXY` environment
You may have noticed in the example, when using a glob the pattern is encapsulated in quotes:

```sh
linkinator "**/*.md" --markdown
npx linkinator "**/*.md" --markdown
```

Without the quotes, some shells will attempt to expand the glob paths on their own. Various shells (bash, zsh) have different, somewhat unpredictable behaviors when left to their own devices. Using the quotes ensures consistent, predictable behavior by letting the library expand the pattern.
Expand All @@ -351,15 +351,15 @@ Without the quotes, some shells will attempt to expand the glob paths on their o
Oftentimes when a link fails, it's an easy to spot typo, or a clear 404. Other times ... you may need more details on exactly what went wrong. To see a full call stack for the HTTP request failure, use `--verbosity DEBUG`:

```sh
linkinator https://jbeckwith.com --verbosity DEBUG
npx linkinator https://jbeckwith.com --verbosity DEBUG
```

### Controlling Output

The `--verbosity` flag offers preset options for controlling the output, but you may want more control. Using [`jq`](https://stedolan.github.io/jq/) and `--format JSON` - you can do just that!

```sh
linkinator https://jbeckwith.com --verbosity DEBUG --format JSON | jq '.links | .[] | select(.state | contains("BROKEN"))'
npx linkinator https://jbeckwith.com --verbosity DEBUG --format JSON | jq '.links | .[] | select(.state | contains("BROKEN"))'
```

## License
Expand Down

0 comments on commit 30eedaf

Please sign in to comment.