Skip to content

Commit

Permalink
Update package versions in Cargo.lock
Browse files Browse the repository at this point in the history
  • Loading branch information
hitsmaxft committed Feb 7, 2024
1 parent d0d735d commit 70ba797
Show file tree
Hide file tree
Showing 4 changed files with 205 additions and 1 deletion.
193 changes: 193 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ futures = "0.3.30"
shellexpand = "3.1.0"
tokio-stream = "0.1.14"
clap-stdin = "0.4.0"
termimad = "0.29.0"

[dependencies.google-generative-ai-rs]

Expand Down
5 changes: 5 additions & 0 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ pub fn create_cli_app() -> App<'static>{
.long("verbose")
.help("output more logs"),
)
.arg(
Arg::with_name("rich")
.long("rich")
.help("output the response in rich terminal"),
)
.arg(
Arg::with_name("stream")
.long("stream")
Expand Down
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ async fn run(matches: ArgMatches) -> Result<(), Box<dyn std::error::Error>> {
.unwrap_or("~/.config/gemini-cli.toml");

let is_stream = matches.contains_id("stream");
let is_rich = matches.contains_id("rich");
let config = cli::read_config(config_path).await?;

let token = matches
Expand Down Expand Up @@ -100,7 +101,11 @@ async fn run(matches: ArgMatches) -> Result<(), Box<dyn std::error::Error>> {
.first()
.and_then(|c| c.content.parts.first().and_then(|p| p.text.as_ref()))
{
print!("{}", text);
if is_rich {
termimad::print_inline(text);
} else {
println!("{}", text);
}
}
}

Expand Down

0 comments on commit 70ba797

Please sign in to comment.