Add hint about separating inputs from options with -- (fixes #113) (#119)

This commit is contained in:
Matthias 2021-01-17 17:01:06 +01:00 committed by GitHub
parent bfeeb28e1d
commit a50c04fffe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 7 deletions

View file

@ -189,7 +189,8 @@ OPTIONS:
ARGS:
<inputs>... The inputs (where to get links to check from). These can be: files (e.g. `README.md`), file globs
(e.g. `"~/git/*/README.md"`), remote URLs (e.g. `https://example.com/README.md`) or standard
input (`-`) [default: README.md]
input (`-`). Prefix with `--` to separate inputs from options that allow multiple arguments
[default: README.md]
```
### Exit codes

View file

@ -84,6 +84,7 @@ pub(crate) struct LycheeOptions {
/// The inputs (where to get links to check from).
/// These can be: files (e.g. `README.md`), file globs (e.g. `"~/git/*/README.md"`),
/// remote URLs (e.g. `https://example.com/README.md`) or standard input (`-`).
/// Prefix with `--` to separate inputs from options that allow multiple arguments.
#[structopt(name = "inputs", default_value = "README.md")]
raw_inputs: Vec<String>,

View file

@ -92,7 +92,7 @@ impl Input {
}
}
Stdin => Ok(vec![Self::stdin_content(file_type_hint).await?]),
String(s) => Ok(vec![Self::string_content(s, file_type_hint)?]),
String(s) => Ok(vec![Self::string_content(s, file_type_hint)]),
}
}
@ -152,11 +152,8 @@ impl Input {
Ok(input_content)
}
fn string_content(s: &str, file_type_hint: Option<FileType>) -> Result<InputContent> {
Ok(InputContent::from_string(
s,
file_type_hint.unwrap_or_default(),
))
fn string_content(s: &str, file_type_hint: Option<FileType>) -> InputContent {
InputContent::from_string(s, file_type_hint.unwrap_or_default())
}
}