| 3048 | } |
| 3049 | |
| 3050 | void ShellState::DetectDarkLightMode() { |
| 3051 | #ifdef HAVE_LINENOISE |
| 3052 | ShellHighlight highlight(*this); |
| 3053 | if (highlight_mode != HighlightMode::AUTOMATIC) { |
| 3054 | // highlight mode is specified by the user - avoid setting manually |
| 3055 | return; |
| 3056 | } |
| 3057 | if (!stdout_is_console) { |
| 3058 | // not printing to console - don't auto-detect |
| 3059 | return; |
| 3060 | } |
| 3061 | // detect terminal colors |
| 3062 | auto terminal_color = linenoiseGetTerminalColorMode(); |
| 3063 | if (terminal_color == LINENOISE_DARK_MODE) { |
| 3064 | highlight_mode = HighlightMode::DARK_MODE; |
| 3065 | highlight.ToggleMode(HighlightMode::DARK_MODE); |
| 3066 | } else if (terminal_color == LINENOISE_LIGHT_MODE) { |
| 3067 | highlight_mode = HighlightMode::LIGHT_MODE; |
| 3068 | highlight.ToggleMode(HighlightMode::LIGHT_MODE); |
| 3069 | } else { |
| 3070 | highlight_mode = HighlightMode::MIXED_MODE; |
| 3071 | } |
| 3072 | #endif |
| 3073 | } |
| 3074 | |
| 3075 | int RunShell(int argc, const char **argv) { |
| 3076 | int rc = 0; |
no test coverage detected