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