added: option to force colorized output
This commit is contained in:
parent
b33e769cf8
commit
110946b1e1
|
@ -234,13 +234,14 @@ void print_help(void) {
|
|||
" --print-ir print resulting LLVM-IR to a file",
|
||||
" --mode=[app|lib] set the compilation mode to either application or library",
|
||||
" --output=name name of output files without extension",
|
||||
" --link-paths=[paths,] set a list of directories to for libraries in"
|
||||
" --link-paths=[paths,] set a list of directories to for libraries in",
|
||||
"Options:",
|
||||
" --verbose print logs with level information or higher",
|
||||
" --debug print debug logs (if not disabled at compile time)",
|
||||
" --version print the version",
|
||||
" --list-targets print a list of all available targets supported"
|
||||
" --help print this help dialog"
|
||||
" --list-targets print a list of all available targets supported",
|
||||
" --help print this help dialog",
|
||||
" --color-always always colorize output"
|
||||
};
|
||||
|
||||
for (unsigned int i = 0; i < sizeof(lines) / sizeof(const char *); i++) {
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
typedef struct TargetLinkConfig_t {
|
||||
// name of object files to link
|
||||
GArray* object_file_names;
|
||||
} TargetLinktConfig;
|
||||
} TargetLinkConfig;
|
||||
|
||||
typedef enum TargetCompilationMode_t {
|
||||
// output an executable binary
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <string.h>
|
||||
#include <sys/col.h>
|
||||
#include <sys/log.h>
|
||||
#include <cfg/opt.h>
|
||||
|
||||
#ifdef __unix__
|
||||
#include <unistd.h>
|
||||
|
@ -55,6 +56,10 @@ void enable_ansi_colors() {
|
|||
|
||||
int stdout_supports_ansi_esc() {
|
||||
|
||||
if (is_option_set("color-always")) {
|
||||
return ANSI_ENABLED;
|
||||
}
|
||||
|
||||
#ifdef __unix__
|
||||
// check if TTY
|
||||
if (isatty(STDOUT_FILENO)) {
|
||||
|
|
Loading…
Reference in New Issue