From a50c04fffe983246769671154fd241a612e168ee Mon Sep 17 00:00:00 2001 From: Matthias Date: Sun, 17 Jan 2021 17:01:06 +0100 Subject: [PATCH] Add hint about separating inputs from options with `--` (fixes #113) (#119) --- README.md | 3 ++- src/bin/lychee/options.rs | 1 + src/collector.rs | 9 +++------ 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 321ccbc..eea2133 100644 --- a/README.md +++ b/README.md @@ -189,7 +189,8 @@ OPTIONS: ARGS: ... 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 diff --git a/src/bin/lychee/options.rs b/src/bin/lychee/options.rs index f282d47..4499101 100644 --- a/src/bin/lychee/options.rs +++ b/src/bin/lychee/options.rs @@ -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, diff --git a/src/collector.rs b/src/collector.rs index 263bff1..2a7a285 100644 --- a/src/collector.rs +++ b/src/collector.rs @@ -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) -> Result { - Ok(InputContent::from_string( - s, - file_type_hint.unwrap_or_default(), - )) + fn string_content(s: &str, file_type_hint: Option) -> InputContent { + InputContent::from_string(s, file_type_hint.unwrap_or_default()) } }