Skip to content

Commit

Permalink
Add support for reading from stdin and make input handling more robust (
Browse files Browse the repository at this point in the history
closes #26)

* Adds a `skip_missing` flag
* Adds an `Input` enum to handle different types of inputs
  • Loading branch information
pawroman authored Dec 2, 2020
1 parent e197012 commit 1f78761
Show file tree
Hide file tree
Showing 11 changed files with 736 additions and 149 deletions.
80 changes: 80 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ quick-xml = "0.20.0"
headers = "0.3.2"
derive_builder = "0.9.0"
deadpool = "0.6.0"
shellexpand = "2.0"
lazy_static = "1.1"

[dependencies.reqwest]
features = ["gzip"]
Expand All @@ -43,3 +45,5 @@ version = "0.2"
wiremock = "0.3"
assert_cmd = "1.0"
predicates = "1.0"
uuid = { version = "0.8", features = ["v4"] }
tempfile = "3.1"
28 changes: 25 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,32 @@ cargo install lychee

## Usage

Run it inside a repository with a `README.md`, or specify a file with
Run it inside a repository with a `README.md`:

```
lychee <yourfile>
lychee
```

You can also specify various types of inputs:

```
# check links on a website:
lychee https://endler.dev/
# check links in a remote file:
lychee https://raw.githubusercontent.com/lycheeverse/lychee/master/README.md
# check links in local file(s):
lychee README.md
lychee test.html info.txt
# check links in local files (by shell glob):
lychee ~/projects/*/README.md
# check links in local files (lychee supports advanced globbing and ~ expansion):
lychee "~/projects/big_project/**/README.*"
# ignore case when globbing, displaying progress and check result for each link:
lychee --glob-ignore-case --progress --verbose "~/projects/**/[r]eadme.*"
```

Optional (to avoid getting rate-limited): set an environment variable with your Github token
Expand All @@ -93,7 +115,7 @@ config file.
### CLI exit codes

- `0` for success (all links checked successfully or excluded/skipped as configured)
- `1` for any unexpected runtime failures or config errors
- `1` for missing inputs and any unexpected runtime failures or config errors
- `2` for link check failures (if any non-excluded link failed the check)

## Troubleshooting and workarounds
Expand Down
3 changes: 0 additions & 3 deletions fixtures/TEST_404.md

This file was deleted.

Loading

0 comments on commit 1f78761

Please sign in to comment.