Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Patch for handling no input #342

Closed
emmatebibyte opened this issue Feb 23, 2024 · 1 comment
Closed

[BUG] Patch for handling no input #342

emmatebibyte opened this issue Feb 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@emmatebibyte
Copy link

diff --git a/src/cli/mod.rs b/src/cli/mod.rs
index b28d59d..021a4d7 100644
--- a/src/cli/mod.rs
+++ b/src/cli/mod.rs
@@ -69,8 +69,10 @@ pub fn parse_cli_args() -> (String, Config) {
     let input_text: String = if opts.file.is_some() {
         read_and_parse_file(opts.file.unwrap())
     } else {
-        opts.text
-            .expect("Error. No input was provided. Please use ares --help")
+        opts.text.unwrap_or_else(|| {
+            eprintln!("Error. No input was provided. Please use ares --help");
+            std::process::exit(1);
+        })
     };
 
     // Fixes bug where opts.text and opts.file are partially borrowed
@emmatebibyte emmatebibyte added the bug Something isn't working label Feb 23, 2024
@gregorni
Copy link
Contributor

Is this still relevant in 2025? Especially since we're reworking how to handle empty input in #310 anyways.

@bee-san bee-san closed this as completed Feb 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants