Repository: foresterre/sic (language: rust)

Issue:
How to use `stdin`?
I am trying to call out to `sic` from my program, feeding the image to `sic` via `stdin`. However, I keep getting the following error message:
```
Error: Unable select input/output mode: mode should either be simple xor glob
```
Inferring from the help message, I am assuming that when no `--input` or `--glob-input` is provided, `sic` will read from `stdin`, but that doesn't seem to be the case.


Discussion / hints:

Fix patch:
diff --git a/src/cli/app.rs b/src/cli/app.rs
index 56de4970c..cadc9b46d 100644
--- a/src/cli/app.rs
+++ b/src/cli/app.rs
@@ -399,7 +399,7 @@ pub fn build_app_config<'a>(matches: &'a ArgMatches) -> anyhow::Result<Config<'a
         return Ok(builder.build());
     }
 
-    builder = builder.mode(InputOutputModeType::from_arg_matches(matches)?);
+    builder = builder.mode(InputOutputModeType::from_arg_matches(matches));
 
     // config(in)/select-frame:
     if let Some(value) = matches.value_of(ARG_SELECT_FRAME) {
diff --git a/src/cli/config.rs b/src/cli/config.rs
index 3bdfa8851..6f244e54f 100644
--- a/src/cli/config.rs
+++ b/src/cli/config.rs
@@ -27,6 +27,7 @@ impl PathVariant {
     }
 }
 
+#[derive(Debug)]
 pub enum InputOutputMode {
     Single {
         input: PathVariant,
@@ -40,7 +41,7 @@ pub enum InputOutputMode {
 
 impl InputOutputMode {
     pub fn try_from_matches(matches: &ArgMatches) -> anyhow::Result<Self> {
-        let mode = InputOutputModeType::from_arg_matches(matches)?;
+        let mode = InputOutputModeType::from_arg_matches(matches);
 
         match mode {
             InputOutputModeType::Simple => Ok(InputOutputMode::Single {
@@ -140,19 +141,12 @@ pub enum InputOutputModeType {
 }
 
 impl InputOutputModeType {
-    pub fn from_arg_matches(matches: &ArgMatches) -> anyhow::Result<InputOutputModeType> {
-        Ok(
-            match (
-                matches.is_present(ARG_INPUT),
-                matches.is_present(ARG_INPUT_GLOB),
-            ) {
-                (true, false) => InputOutputModeType::Simple,
-                (false, true) => InputOutputModeType::Batch,
-                _ => {
-                    bail!("Unable select input/output mode: mode should either be simple xor glob")
-                }
-            },
-        )
+    pub fn from_arg_matches(matches: &ArgMatches) -> InputOutputModeType {
+        if matches.is_present(ARG_INPUT_GLOB) {
+            InputOutputModeType::Batch
+        } else {
+            InputOutputModeType::Simple
+        }
     }
 }
 


Test patch: