summaryrefslogtreecommitdiffstats
path: root/src/function.rs
diff options
context:
space:
mode:
authorsigoden <sigoden@gmail.com>2024-06-06 06:08:41 +0800
committerGitHub <noreply@github.com>2024-06-06 06:08:41 +0800
commit93ef6da6298f3a98127ed572659b6c24a3f5295e (patch)
tree7f11cb9adfc7ab5cdfc420cf69d10dcde15179c3 /src/function.rs
parentc26594c3c85fb99ad5b0db1c535b337585d3c103 (diff)
downloadaichat-93ef6da6298f3a98127ed572659b6c24a3f5295e.tar.gz
refactor: global IS_STDOUT_TERMINAL (#571)
Diffstat (limited to 'src/function.rs')
-rw-r--r--src/function.rs5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/function.rs b/src/function.rs
index a42b943..9cb098a 100644
--- a/src/function.rs
+++ b/src/function.rs
@@ -2,6 +2,7 @@ use crate::{
config::GlobalConfig,
utils::{
dimmed_text, get_env_bool, indent_text, run_command, run_command_with_output, warning_text,
+ IS_STDOUT_TERMINAL,
},
};
@@ -9,14 +10,12 @@ use anyhow::{anyhow, bail, Context, Result};
use fancy_regex::Regex;
use indexmap::{IndexMap, IndexSet};
use inquire::{validator::Validation, Text};
-use is_terminal::IsTerminal;
use lazy_static::lazy_static;
use serde::{Deserialize, Serialize};
use serde_json::{json, Value};
use std::{
collections::{HashMap, HashSet},
fs,
- io::stdout,
path::Path,
sync::mpsc::channel,
};
@@ -232,7 +231,7 @@ impl ToolCall {
let name = polyfill_cmd_name(&name, &config.read().function.bin_dir);
let output = if self.is_execute() {
- if stdout().is_terminal() {
+ if *IS_STDOUT_TERMINAL {
println!("{prompt}");
let answer = Text::new("[1] Run, [2] Run & Retrieve, [3] Skip:")
.with_default("1")