Skip to content

Commit

Permalink
Merge pull request #30 from glcraft/fixes
Browse files Browse the repository at this point in the history
Fix piped input
  • Loading branch information
glcraft authored Sep 23, 2023
2 parents e7dcc50 + 81a224c commit 9a7ad5c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "aio-cli"
description = "Streamlined AI Terminal Interactions"
version = "0.7.2"
version = "0.7.3"
edition = "2021"
authors = ["Gabin Lefranc <[email protected]>"]
readme = "README.md"
Expand All @@ -22,7 +22,7 @@ anyhow = "1.0"
async-trait = "0.1"
bytes = "1.1.0"
clap = { version = "4.2.2", features = ["derive"] }
crossterm = "0.27"
crossterm = "0.26"
num-traits = "0.2"
once_cell = "1.18"
pin-project = "1.1"
Expand Down
2 changes: 1 addition & 1 deletion src/arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ pub enum RunChoice {
/// Run code without asking
Force
}

#[derive(Default, Debug, Clone)]
pub struct ProcessedArgs {
pub config_path: String,
pub creds_path: String,
Expand Down
6 changes: 4 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,10 @@ async fn main() -> Result<(), String> {
if let None = args.input {
use std::io::Read;
let mut str_input = std::string::String::new();
std::io::stdin().lock().read_to_string(&mut str_input).map_err(|e| format!("Failed to read input from stdin: {}", e))?;
args.input = Some(str_input);
let mut stdin = std::io::stdin();
stdin.read_to_string(&mut str_input).map_err(|e| format!("Failed to read input from stdin: {}", e))?;

args.input = Some(str_input.trim().to_string());
}
args::ProcessedArgs::from(args)
};
Expand Down

0 comments on commit 9a7ad5c

Please sign in to comment.