diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 1b94bd834..8445045e6 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -64,11 +64,8 @@ jobs: - name: Test the second generation run: ./poac-out/debug/poac test --verbose - - name: Third Generation Build - run: ./poac-out/debug/poac build --verbose --release - - - name: Test the third generation - run: ./poac-out/release/poac test --verbose --release + - name: Third Generation Build & Test + run: ./poac-out/debug/poac --verbose run --release test --verbose --release # - name: Test Poac # run: ctest --output-on-failure --verbose diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 9b629c43b..cebd29e00 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -36,11 +36,8 @@ jobs: - name: Test the second generation run: ./poac-out/debug/poac test --verbose - - name: Third Generation Build - run: ./poac-out/debug/poac build --verbose --release - - - name: Test the third generation - run: ./poac-out/release/poac test --verbose --release + - name: Third Generation Build & Test + run: ./poac-out/debug/poac --verbose run --release test --verbose --release # - name: Test Poac # run: ctest --output-on-failure --verbose diff --git a/src/main.cc b/src/main.cc index 833839667..b5e9a8ca7 100644 --- a/src/main.cc +++ b/src/main.cc @@ -52,16 +52,28 @@ int help(Vec args) { int main(int argc, char* argv[]) { // Parse global options Vec args; + bool isVerbositySet = false; for (int i = 1; i < argc; ++i) { String arg = argv[i]; if (arg == "-v" || arg == "--version") { std::cout << "poac " << POAC_VERSION << '\n'; return EXIT_SUCCESS; } - if (arg == "--verbose") { - Logger::setLevel(LogLevel::debug); - } else if (arg == "-q" || arg == "--quiet") { - Logger::setLevel(LogLevel::error); + + // This is a bit of a hack to allow the global options to be specified + // in poac run, e.g., `poac run --verbose test --verbose`. This will + // remove the first --verbose and execute the run command as verbose, + // then run the test command as verbose. + if (!isVerbositySet) { + if (arg == "--verbose") { + Logger::setLevel(LogLevel::debug); + isVerbositySet = true; + } else if (arg == "-q" || arg == "--quiet") { + Logger::setLevel(LogLevel::error); + isVerbositySet = true; + } else { + args.push_back(arg); + } } else { args.push_back(arg); }