Skip to content

feat: disable text styling in --no-interactive mode #2464

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions crates/chat-cli/src/cli/chat/conversation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ use std::collections::{
use std::io::Write;
use std::sync::atomic::Ordering;

use crossterm::style;
use crossterm::style::Color;
use crossterm::{
execute,
style,
};
use serde::{
Deserialize,
Serialize,
Expand Down Expand Up @@ -64,6 +61,7 @@ use crate::cli::agent::hook::{
HookTrigger,
};
use crate::cli::chat::ChatError;
use crate::execute_conditional;
use crate::mcp_client::Prompt;
use crate::os::Os;

Expand Down Expand Up @@ -332,6 +330,7 @@ impl ConversationState {
&mut self,
os: &Os,
stderr: &mut impl Write,
enable_syling: bool,
run_perprompt_hooks: bool,
) -> Result<FigConversationState, ChatError> {
debug_assert!(self.next_message.is_some());
Expand All @@ -341,7 +340,8 @@ impl ConversationState {

let context = self.backend_conversation_state(os, run_perprompt_hooks, stderr).await?;
if !context.dropped_context_files.is_empty() {
execute!(
execute_conditional!(
enable_syling,
stderr,
style::SetForegroundColor(Color::DarkYellow),
style::Print("\nSome context files are dropped due to size limit, please run "),
Expand Down Expand Up @@ -1069,7 +1069,7 @@ mod tests {
conversation.set_next_user_message("start".to_string()).await;
for i in 0..=(MAX_CONVERSATION_STATE_HISTORY_LEN + 100) {
let s = conversation
.as_sendable_conversation_state(&os, &mut vec![], true)
.as_sendable_conversation_state(&os, &mut vec![], true, true)
.await
.unwrap();
assert_conversation_state_invariants(s, i);
Expand Down Expand Up @@ -1097,7 +1097,7 @@ mod tests {
conversation.set_next_user_message("start".to_string()).await;
for i in 0..=(MAX_CONVERSATION_STATE_HISTORY_LEN + 100) {
let s = conversation
.as_sendable_conversation_state(&os, &mut vec![], true)
.as_sendable_conversation_state(&os, &mut vec![], true, true)
.await
.unwrap();
assert_conversation_state_invariants(s, i);
Expand Down Expand Up @@ -1125,7 +1125,7 @@ mod tests {
conversation.set_next_user_message("start".to_string()).await;
for i in 0..=(MAX_CONVERSATION_STATE_HISTORY_LEN + 100) {
let s = conversation
.as_sendable_conversation_state(&os, &mut vec![], true)
.as_sendable_conversation_state(&os, &mut vec![], true, true)
.await
.unwrap();
assert_conversation_state_invariants(s, i);
Expand Down Expand Up @@ -1181,7 +1181,7 @@ mod tests {
conversation.set_next_user_message("start".to_string()).await;
for i in 0..=(MAX_CONVERSATION_STATE_HISTORY_LEN + 100) {
let s = conversation
.as_sendable_conversation_state(&os, &mut vec![], true)
.as_sendable_conversation_state(&os, &mut vec![], true, true)
.await
.unwrap();

Expand Down
Loading