7#include <ascii-chat/platform/terminal.h>
8#include <ascii-chat/platform/abstraction.h>
9#include <ascii-chat/options/options.h>
10#include <ascii-chat/options/rcu.h>
11#include <ascii-chat/common.h>
12#include <ascii-chat/log/logging.h>
33 int color_mode = GET_OPTION(color_mode);
34 if (color_mode == COLOR_MODE_NONE) {
39 int color_setting = GET_OPTION(color);
42 if (color_setting == COLOR_SETTING_TRUE) {
47 if (color_setting == COLOR_SETTING_FALSE) {
57 for (
int i = 1; i <
g_argc; i++) {
58 if (strcmp(
g_argv[i],
"--help") == 0 || strcmp(
g_argv[i],
"-h") == 0 || strcmp(
g_argv[i],
"--version") == 0 ||
59 strcmp(
g_argv[i],
"-v") == 0 || strcmp(
g_argv[i],
"--show-capabilities") == 0) {
69 if (SAFE_GETENV(
"ASCII_CHAT_COLOR")) {
74 if (SAFE_GETENV(
"CLAUDECODE")) {
85 if (SAFE_GETENV(
"ASCII_CHAT_COLOR")) {
90 if (SAFE_GETENV(
"CLAUDECODE")) {
117 return TERM_COLOR_NONE;
121 terminal_color_mode_t color_mode = GET_OPTION(color_mode);
122 if (color_mode != TERM_COLOR_AUTO) {
129 return TERM_COLOR_AUTO;
160 const char *testing = SAFE_GETENV(
"TESTING");
161 if (testing && strcmp(testing,
"1") == 0) {
176 if (GET_OPTION(snapshot_mode)) {
181 const char *auto_response = SAFE_GETENV(
"ASCII_CHAT_QUESTION_PROMPT_RESPONSE");
182 if (auto_response && *auto_response !=
'\0') {
195 return STDERR_FILENO;
201 if (level >= LOG_WARN) {
202 return STDERR_FILENO;
205 return STDOUT_FILENO;
ASCIICHAT_API char ** g_argv
bool log_get_force_stderr(void)
int platform_isatty(int fd)