Factor out version-printing to usage.cpp (#1870)

This commit is contained in:
Rangi
2025-12-05 23:04:49 -05:00
committed by GitHub
parent c8161be23a
commit 33475e2c36
6 changed files with 14 additions and 11 deletions

View File

@@ -9,6 +9,7 @@
#include "helpers.hpp"
#include "platform.hpp"
#include "style.hpp"
#include "version.hpp"
#if defined(_MSC_VER) || defined(__MINGW32__)
#define WIN32_LEAN_AND_MEAN // Include less from `windows.h`
@@ -17,6 +18,10 @@
#include <sys/ioctl.h>
#endif
void Usage::printVersion(bool error) const {
fprintf(error ? stderr : stdout, "%s %s\n", name.c_str(), get_package_version_string());
}
void Usage::printAndExit(int code) const {
FILE *file;
bool isTerminal;