Skip to content

Commit

Permalink
Added --no-color option, #6
Browse files Browse the repository at this point in the history
  • Loading branch information
p-ranav committed Apr 30, 2022
1 parent c830ef2 commit b015ccd
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion source/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace fs = std::filesystem;

int main(int argc, char* argv[])
{
const auto is_stdout = isatty(STDOUT_FILENO) == 1;
auto is_stdout = isatty(STDOUT_FILENO) == 1;
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
argparse::ArgumentParser program("fccf", "0.5.0");
Expand Down Expand Up @@ -196,6 +196,11 @@ int main(int argc, char* argv[])
.default_value<std::string>(std::string {"c++17"})
.help("C++ standard to be used by clang");

program.add_argument("--nc", "--no-color")
.help("Stops fccf from coloring the output")
.default_value(false)
.implicit_value(true);

try {
program.parse_args(argc, argv);
} catch (const std::runtime_error& err) {
Expand Down Expand Up @@ -252,6 +257,12 @@ int main(int argc, char* argv[])
auto ignore_single_line_results =
program.get<bool>("--ignore-single-line-results");

auto no_color = program.get<bool>("--no-color");

if (no_color) {
is_stdout = false;
}

auto no_filter =
!(search_for_enum || search_for_struct || search_for_union
|| search_for_member_function || search_for_function
Expand Down

0 comments on commit b015ccd

Please sign in to comment.