Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make -q to silence header, and stdout if specified twice #63575

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions main/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ static ZipArchive *zip_packed_data = nullptr;
#endif
static FileAccessNetworkClient *file_access_network_client = nullptr;
static MessageQueue *message_queue = nullptr;
static bool quiet_header = false;

// Initialized in setup2()
static AudioServer *audio_server = nullptr;
Expand Down Expand Up @@ -281,7 +282,7 @@ void Main::print_help(const char *p_binary) {
OS::get_singleton()->print(" -h, --help Display this help message.\n");
OS::get_singleton()->print(" --version Display the version string.\n");
OS::get_singleton()->print(" -v, --verbose Use verbose stdout mode.\n");
OS::get_singleton()->print(" -q, --quiet Quiet mode, silences stdout messages. Errors are still displayed.\n");
OS::get_singleton()->print(" -q, --quiet Be quiet. Silences header if specified once, and all stdout messages if present twice. Errors are still displayed.\n");
OS::get_singleton()->print("\n");

OS::get_singleton()->print("Run options:\n");
Expand Down Expand Up @@ -712,7 +713,14 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph

OS::get_singleton()->_verbose_stdout = true;
} else if (I->get() == "-q" || I->get() == "--quiet") { // quieter output

if (quiet_header) {
// the option is specified twice
quiet_stdout = true;
} else {
quiet_header = true;
}
} else if (I->get() == "-qq") {
quiet_header = true;
quiet_stdout = true;

} else if (I->get() == "--audio-driver") { // audio driver
Expand Down Expand Up @@ -1694,7 +1702,9 @@ Error Main::setup2(Thread::ID p_main_tid_override) {
NativeExtensionManager::get_singleton()->initialize_extensions(NativeExtension::INITIALIZATION_LEVEL_SERVERS);

// Print engine name and version
print_line(String(VERSION_NAME) + " v" + get_full_version_string() + " - " + String(VERSION_WEBSITE));
if (!quiet_header) {
print_line(String(VERSION_NAME) + " v" + get_full_version_string() + " - " + String(VERSION_WEBSITE));
}

#if !defined(NO_THREADS)
if (p_main_tid_override) {
Expand Down