mirror of
https://github.com/AxioDL/metaforce.git
synced 2025-12-08 13:44:56 +00:00
Massive fmtlib refactor
This commit is contained in:
@@ -55,9 +55,9 @@ protected:
|
||||
bool continuePrompt() {
|
||||
if (!m_info.yes) {
|
||||
if (XTERM_COLOR)
|
||||
hecl::Printf(_SYS_STR("\n" BLUE BOLD "Continue?" NORMAL " (Y/n) "));
|
||||
fmt::print(fmt(_SYS_STR("\n" BLUE BOLD "Continue?" NORMAL " (Y/n) ")));
|
||||
else
|
||||
hecl::Printf(_SYS_STR("\nContinue? (Y/n) "));
|
||||
fmt::print(fmt(_SYS_STR("\nContinue? (Y/n) ")));
|
||||
fflush(stdout);
|
||||
|
||||
int ch;
|
||||
@@ -73,7 +73,7 @@ protected:
|
||||
#endif
|
||||
{
|
||||
if (ch == 'n' || ch == 'N') {
|
||||
hecl::Printf(_SYS_STR("\n"));
|
||||
fmt::print(fmt(_SYS_STR("\n")));
|
||||
return false;
|
||||
}
|
||||
if (ch == 'y' || ch == 'Y' || ch == '\r' || ch == '\n')
|
||||
@@ -83,7 +83,7 @@ protected:
|
||||
tcsetattr(0, TCSANOW, &tioOld);
|
||||
#endif
|
||||
}
|
||||
hecl::Printf(_SYS_STR("\n"));
|
||||
fmt::print(fmt(_SYS_STR("\n")));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -175,27 +175,27 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
void print(const hecl::SystemChar* str) { hecl::FPrintf(m_sout, _SYS_STR("%s"), str); }
|
||||
void print(const hecl::SystemChar* str) { fmt::print(m_sout, fmt(_SYS_STR("{}")), str); }
|
||||
|
||||
void printBold(const hecl::SystemChar* str) {
|
||||
if (XTERM_COLOR)
|
||||
hecl::FPrintf(m_sout, _SYS_STR("" BOLD "%s" NORMAL ""), str);
|
||||
fmt::print(m_sout, fmt(_SYS_STR("" BOLD "{}" NORMAL "")), str);
|
||||
else
|
||||
hecl::FPrintf(m_sout, _SYS_STR("%s"), str);
|
||||
fmt::print(m_sout, fmt(_SYS_STR("{}")), str);
|
||||
}
|
||||
|
||||
void secHead(const hecl::SystemChar* headName) {
|
||||
if (XTERM_COLOR)
|
||||
hecl::FPrintf(m_sout, _SYS_STR("" BOLD "%s" NORMAL "\n"), headName);
|
||||
fmt::print(m_sout, fmt(_SYS_STR("" BOLD "{}" NORMAL "\n")), headName);
|
||||
else
|
||||
hecl::FPrintf(m_sout, _SYS_STR("%s\n"), headName);
|
||||
fmt::print(m_sout, fmt(_SYS_STR("{}\n")), headName);
|
||||
}
|
||||
|
||||
void optionHead(const hecl::SystemChar* flag, const hecl::SystemChar* synopsis) {
|
||||
if (XTERM_COLOR)
|
||||
hecl::FPrintf(m_sout, _SYS_STR("" BOLD "%s" NORMAL " (%s)\n"), flag, synopsis);
|
||||
fmt::print(m_sout, fmt(_SYS_STR("" BOLD "{}" NORMAL " ({})\n")), flag, synopsis);
|
||||
else
|
||||
hecl::FPrintf(m_sout, _SYS_STR("%s (%s)\n"), flag, synopsis);
|
||||
fmt::print(m_sout, fmt(_SYS_STR("{} ({})\n")), flag, synopsis);
|
||||
}
|
||||
|
||||
void beginWrap() { m_wrapBuffer.clear(); }
|
||||
@@ -213,7 +213,7 @@ public:
|
||||
void endWrap() {
|
||||
_wrapBuf(m_wrapBuffer);
|
||||
m_wrapBuffer += _SYS_STR('\n');
|
||||
hecl::FPrintf(m_sout, _SYS_STR("%s"), m_wrapBuffer.c_str());
|
||||
fmt::print(m_sout, fmt(_SYS_STR("{}")), m_wrapBuffer);
|
||||
m_wrapBuffer.clear();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
}
|
||||
}
|
||||
if (!m_spec)
|
||||
LogModule.report(logvisor::Fatal, "unable to find data spec '%s'", specName.c_str());
|
||||
LogModule.report(logvisor::Fatal, fmt("unable to find data spec '{}'"), specName);
|
||||
continue;
|
||||
} else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-'))
|
||||
continue;
|
||||
@@ -51,18 +51,18 @@ public:
|
||||
m_useProj = m_fallbackProj.get();
|
||||
} else if (m_fallbackProj->getProjectRootPath() != root)
|
||||
LogModule.report(logvisor::Fatal,
|
||||
_SYS_STR("hecl cook can only process multiple items in the same project; ")
|
||||
_SYS_STR("'%s' and '%s' are different projects"),
|
||||
m_fallbackProj->getProjectRootPath().getAbsolutePath().data(),
|
||||
root.getAbsolutePath().data());
|
||||
fmt(_SYS_STR("hecl cook can only process multiple items in the same project; ")
|
||||
_SYS_STR("'{}' and '{}' are different projects")),
|
||||
m_fallbackProj->getProjectRootPath().getAbsolutePath(),
|
||||
root.getAbsolutePath());
|
||||
m_selectedItems.emplace_back(*m_useProj, subPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!m_useProj)
|
||||
LogModule.report(logvisor::Fatal,
|
||||
"hecl cook must be ran within a project directory or "
|
||||
"provided a path within a project");
|
||||
fmt("hecl cook must be ran within a project directory or "
|
||||
"provided a path within a project"));
|
||||
|
||||
/* Default case: recursive at root */
|
||||
if (m_selectedItems.empty()) {
|
||||
|
||||
@@ -29,7 +29,7 @@ class ToolExtract final : public ToolBase {
|
||||
public:
|
||||
ToolExtract(const ToolPassInfo& info) : ToolBase(info) {
|
||||
if (!m_info.args.size())
|
||||
LogModule.report(logvisor::Fatal, "hecl extract needs a source path as its first argument");
|
||||
LogModule.report(logvisor::Fatal, fmt("hecl extract needs a source path as its first argument"));
|
||||
|
||||
if (!info.project) {
|
||||
hecl::SystemString rootDir;
|
||||
@@ -47,7 +47,7 @@ public:
|
||||
baseFile.assign(baseFile.begin(), baseFile.begin() + dotPos);
|
||||
|
||||
if (baseFile.empty())
|
||||
LogModule.report(logvisor::Fatal, "hecl extract must be ran within a project directory");
|
||||
LogModule.report(logvisor::Fatal, fmt("hecl extract must be ran within a project directory"));
|
||||
|
||||
rootDir = info.cwd + baseFile;
|
||||
} else {
|
||||
@@ -62,8 +62,8 @@ public:
|
||||
newProjRoot.makeDir();
|
||||
m_fallbackProj.reset(new hecl::Database::Project(newProjRoot));
|
||||
if (logvisor::ErrorCount > ErrorRef)
|
||||
LogModule.report(logvisor::Fatal, "unable to init project at '%s'", rootDir.c_str());
|
||||
LogModule.report(logvisor::Info, _SYS_STR("initialized project at '%s/.hecl'"), rootDir.c_str());
|
||||
LogModule.report(logvisor::Fatal, fmt("unable to init project at '{}'"), rootDir);
|
||||
LogModule.report(logvisor::Info, fmt(_SYS_STR("initialized project at '{}/.hecl'")), rootDir);
|
||||
m_useProj = m_fallbackProj.get();
|
||||
} else
|
||||
m_useProj = info.project;
|
||||
@@ -116,15 +116,15 @@ public:
|
||||
|
||||
static void _recursivePrint(int level, hecl::Database::IDataSpec::ExtractReport& rep) {
|
||||
for (int l = 0; l < level; ++l)
|
||||
hecl::Printf(_SYS_STR(" "));
|
||||
fmt::print(fmt(_SYS_STR(" ")));
|
||||
if (XTERM_COLOR)
|
||||
hecl::Printf(_SYS_STR("" BOLD "%s" NORMAL ""), rep.name.c_str());
|
||||
fmt::print(fmt(_SYS_STR("" BOLD "{}" NORMAL "")), rep.name);
|
||||
else
|
||||
hecl::Printf(_SYS_STR("%s"), rep.name.c_str());
|
||||
fmt::print(fmt(_SYS_STR("{}")), rep.name);
|
||||
|
||||
if (rep.desc.size())
|
||||
hecl::Printf(_SYS_STR(" [%s]"), rep.desc.c_str());
|
||||
hecl::Printf(_SYS_STR("\n"));
|
||||
fmt::print(fmt(_SYS_STR(" [{}]")), rep.desc);
|
||||
fmt::print(fmt(_SYS_STR("\n")));
|
||||
for (hecl::Database::IDataSpec::ExtractReport& child : rep.childOpts)
|
||||
_recursivePrint(level + 1, child);
|
||||
}
|
||||
@@ -132,32 +132,32 @@ public:
|
||||
int run() {
|
||||
if (m_specPasses.empty()) {
|
||||
if (XTERM_COLOR)
|
||||
hecl::Printf(_SYS_STR("" RED BOLD "NOTHING TO EXTRACT" NORMAL "\n"));
|
||||
fmt::print(fmt(_SYS_STR("" RED BOLD "NOTHING TO EXTRACT" NORMAL "\n")));
|
||||
else
|
||||
hecl::Printf(_SYS_STR("NOTHING TO EXTRACT\n"));
|
||||
fmt::print(fmt(_SYS_STR("NOTHING TO EXTRACT\n")));
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (XTERM_COLOR)
|
||||
hecl::Printf(_SYS_STR("" GREEN BOLD "ABOUT TO EXTRACT:" NORMAL "\n"));
|
||||
fmt::print(fmt(_SYS_STR("" GREEN BOLD "ABOUT TO EXTRACT:" NORMAL "\n")));
|
||||
else
|
||||
hecl::Printf(_SYS_STR("ABOUT TO EXTRACT:\n"));
|
||||
fmt::print(fmt(_SYS_STR("ABOUT TO EXTRACT:\n")));
|
||||
|
||||
for (hecl::Database::IDataSpec::ExtractReport& rep : m_reps) {
|
||||
_recursivePrint(0, rep);
|
||||
hecl::Printf(_SYS_STR("\n"));
|
||||
fmt::print(fmt(_SYS_STR("\n")));
|
||||
}
|
||||
fflush(stdout);
|
||||
|
||||
if (continuePrompt()) {
|
||||
for (SpecExtractPass& ds : m_specPasses) {
|
||||
if (XTERM_COLOR)
|
||||
hecl::Printf(_SYS_STR("" MAGENTA BOLD "Using DataSpec %s:" NORMAL "\n"), ds.m_entry->m_name.data());
|
||||
fmt::print(fmt(_SYS_STR("" MAGENTA BOLD "Using DataSpec {}:" NORMAL "\n")), ds.m_entry->m_name);
|
||||
else
|
||||
hecl::Printf(_SYS_STR("Using DataSpec %s:\n"), ds.m_entry->m_name.data());
|
||||
fmt::print(fmt(_SYS_STR("Using DataSpec {}:\n")), ds.m_entry->m_name);
|
||||
|
||||
ds.m_instance->doExtract(m_einfo, {true});
|
||||
hecl::Printf(_SYS_STR("\n\n"));
|
||||
fmt::print(fmt(_SYS_STR("\n\n")));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ class ToolHelp final : public ToolBase {
|
||||
public:
|
||||
ToolHelp(const ToolPassInfo& info) : ToolBase(info) {
|
||||
if (m_info.args.empty()) {
|
||||
LogModule.report(logvisor::Error, "help requires a tool name argument");
|
||||
LogModule.report(logvisor::Error, fmt("help requires a tool name argument"));
|
||||
return;
|
||||
}
|
||||
m_good = true;
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
else if (toolName == _SYS_STR("help"))
|
||||
helpFunc = ToolHelp::Help;
|
||||
else {
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unrecognized tool '%s' - can't help"), toolName.c_str());
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("unrecognized tool '{}' - can't help")), toolName);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ class ToolImage final : public ToolBase {
|
||||
public:
|
||||
ToolImage(const ToolPassInfo& info) : ToolBase(info), m_useProj(info.project) {
|
||||
if (!info.project)
|
||||
LogModule.report(logvisor::Fatal, "hecl image must be ran within a project directory");
|
||||
LogModule.report(logvisor::Fatal, fmt("hecl image must be ran within a project directory"));
|
||||
|
||||
/* Scan args */
|
||||
if (info.args.size()) {
|
||||
@@ -40,8 +40,8 @@ public:
|
||||
}
|
||||
if (!m_useProj)
|
||||
LogModule.report(logvisor::Fatal,
|
||||
"hecl image must be ran within a project directory or "
|
||||
"provided a path within a project");
|
||||
fmt("hecl image must be ran within a project directory or "
|
||||
"provided a path within a project"));
|
||||
}
|
||||
|
||||
~ToolImage() {}
|
||||
@@ -75,29 +75,29 @@ public:
|
||||
|
||||
int run() {
|
||||
if (XTERM_COLOR)
|
||||
hecl::Printf(_SYS_STR("" GREEN BOLD "ABOUT TO IMAGE:" NORMAL "\n"));
|
||||
fmt::print(fmt(_SYS_STR("" GREEN BOLD "ABOUT TO IMAGE:" NORMAL "\n")));
|
||||
else
|
||||
hecl::Printf(_SYS_STR("ABOUT TO IMAGE:\n"));
|
||||
fmt::print(fmt(_SYS_STR("ABOUT TO IMAGE:\n")));
|
||||
|
||||
hecl::Printf(_SYS_STR(" %s\n"), m_useProj->getProjectRootPath().getAbsolutePath().data());
|
||||
fmt::print(fmt(_SYS_STR(" {}\n")), m_useProj->getProjectRootPath().getAbsolutePath());
|
||||
fflush(stdout);
|
||||
|
||||
if (continuePrompt()) {
|
||||
hecl::ProjectPath outPath(m_useProj->getProjectWorkingPath(), _SYS_STR("out"));
|
||||
if (!outPath.isDirectory()) {
|
||||
LogModule.report(logvisor::Error, _SYS_STR("%s is not a directory"), outPath.getAbsolutePath().data());
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("{} is not a directory")), outPath.getAbsolutePath());
|
||||
return 1;
|
||||
}
|
||||
|
||||
hecl::ProjectPath bootBinPath(outPath, _SYS_STR("sys/boot.bin"));
|
||||
if (!bootBinPath.isFile()) {
|
||||
LogModule.report(logvisor::Error, _SYS_STR("%s is not a file"), bootBinPath.getAbsolutePath().data());
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("{} is not a file")), bootBinPath.getAbsolutePath());
|
||||
return 1;
|
||||
}
|
||||
|
||||
athena::io::FileReader r(bootBinPath.getAbsolutePath());
|
||||
if (r.hasError()) {
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unable to open %s"), bootBinPath.getAbsolutePath().data());
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("unable to open {}")), bootBinPath.getAbsolutePath());
|
||||
return 1;
|
||||
}
|
||||
std::string id = r.readString(6);
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
fileOut += _SYS_STR(".gcm");
|
||||
if (nod::DiscBuilderGCN::CalculateTotalSizeRequired(outPath.getAbsolutePath()) == UINT64_MAX)
|
||||
return 1;
|
||||
LogModule.report(logvisor::Info, _SYS_STR("Generating %s as GameCube image"), fileOut.c_str());
|
||||
LogModule.report(logvisor::Info, fmt(_SYS_STR("Generating {} as GameCube image")), fileOut);
|
||||
nod::DiscBuilderGCN db(fileOut, progFunc);
|
||||
if (db.buildFromDirectory(outPath.getAbsolutePath()) != nod::EBuildResult::Success)
|
||||
return 1;
|
||||
@@ -122,7 +122,7 @@ public:
|
||||
bool dualLayer;
|
||||
if (nod::DiscBuilderWii::CalculateTotalSizeRequired(outPath.getAbsolutePath(), dualLayer) == UINT64_MAX)
|
||||
return 1;
|
||||
LogModule.report(logvisor::Info, _SYS_STR("Generating %s as %s-layer Wii image"), fileOut.c_str(),
|
||||
LogModule.report(logvisor::Info, fmt(_SYS_STR("Generating {} as {}-layer Wii image")), fileOut,
|
||||
dualLayer ? _SYS_STR("dual") : _SYS_STR("single"));
|
||||
nod::DiscBuilderWii db(fileOut, dualLayer, progFunc);
|
||||
if (db.buildFromDirectory(outPath.getAbsolutePath()) != nod::EBuildResult::Success)
|
||||
|
||||
@@ -18,18 +18,18 @@ public:
|
||||
if (hecl::Stat(dir->c_str(), &theStat)) {
|
||||
hecl::MakeDir(dir->c_str());
|
||||
if (hecl::Stat(dir->c_str(), &theStat)) {
|
||||
LogModule.report(logvisor::Fatal, _SYS_STR("unable to stat '%s'"), dir->c_str());
|
||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("unable to stat '{}'")), *dir);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!S_ISDIR(theStat.st_mode)) {
|
||||
LogModule.report(logvisor::Fatal, _SYS_STR("'%s' is not a directory"), dir->c_str());
|
||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("'{}' is not a directory")), *dir);
|
||||
return;
|
||||
}
|
||||
|
||||
hecl::SystemString testPath = *dir + _SYS_STR("/.hecl/beacon");
|
||||
if (!hecl::Stat(testPath.c_str(), &theStat)) {
|
||||
LogModule.report(logvisor::Fatal, _SYS_STR("project already exists at '%s'"), dir->c_str());
|
||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("project already exists at '{}'")), *dir);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
hecl::Database::Project proj((hecl::ProjectRootPath(*m_dir)));
|
||||
if (logvisor::ErrorCount > ErrorRef)
|
||||
return 1;
|
||||
LogModule.report(logvisor::Info, _SYS_STR("initialized project at '%s/.hecl'"), m_dir->c_str());
|
||||
LogModule.report(logvisor::Info, fmt(_SYS_STR("initialized project at '{}/.hecl'")), *m_dir);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,7 +61,7 @@ class ToolPackage final : public ToolBase {
|
||||
public:
|
||||
ToolPackage(const ToolPassInfo& info) : ToolBase(info), m_useProj(info.project) {
|
||||
if (!info.project)
|
||||
LogModule.report(logvisor::Fatal, "hecl package must be ran within a project directory");
|
||||
LogModule.report(logvisor::Fatal, fmt("hecl package must be ran within a project directory"));
|
||||
|
||||
/* Scan args */
|
||||
if (info.args.size()) {
|
||||
@@ -82,7 +82,7 @@ public:
|
||||
}
|
||||
}
|
||||
if (!m_spec)
|
||||
LogModule.report(logvisor::Fatal, "unable to find data spec '%s'", specName.c_str());
|
||||
LogModule.report(logvisor::Fatal, fmt("unable to find data spec '{}'"), specName);
|
||||
continue;
|
||||
} else if (arg.size() >= 2 && arg[0] == _SYS_STR('-') && arg[1] == _SYS_STR('-'))
|
||||
continue;
|
||||
@@ -96,10 +96,10 @@ public:
|
||||
m_useProj = m_fallbackProj.get();
|
||||
} else if (m_fallbackProj->getProjectRootPath() != root)
|
||||
LogModule.report(logvisor::Fatal,
|
||||
_SYS_STR("hecl package can only process multiple items in the same project; ")
|
||||
_SYS_STR("'%s' and '%s' are different projects"),
|
||||
m_fallbackProj->getProjectRootPath().getAbsolutePath().data(),
|
||||
root.getAbsolutePath().data());
|
||||
fmt(_SYS_STR("hecl package can only process multiple items in the same project; ")
|
||||
_SYS_STR("'{}' and '{}' are different projects")),
|
||||
m_fallbackProj->getProjectRootPath().getAbsolutePath(),
|
||||
root.getAbsolutePath());
|
||||
|
||||
FindSelectedItems({*m_useProj, subPath}, true);
|
||||
}
|
||||
@@ -107,8 +107,8 @@ public:
|
||||
}
|
||||
if (!m_useProj)
|
||||
LogModule.report(logvisor::Fatal,
|
||||
"hecl package must be ran within a project directory or "
|
||||
"provided a path within a project");
|
||||
fmt("hecl package must be ran within a project directory or "
|
||||
"provided a path within a project"));
|
||||
|
||||
/* Default case: recursive at root */
|
||||
if (m_selectedItems.empty())
|
||||
@@ -160,12 +160,12 @@ public:
|
||||
|
||||
int run() {
|
||||
if (XTERM_COLOR)
|
||||
hecl::Printf(_SYS_STR("" GREEN BOLD "ABOUT TO PACKAGE:" NORMAL "\n"));
|
||||
fmt::print(fmt(_SYS_STR("" GREEN BOLD "ABOUT TO PACKAGE:" NORMAL "\n")));
|
||||
else
|
||||
hecl::Printf(_SYS_STR("ABOUT TO PACKAGE:\n"));
|
||||
fmt::print(fmt(_SYS_STR("ABOUT TO PACKAGE:\n")));
|
||||
|
||||
for (auto& item : m_selectedItems)
|
||||
hecl::Printf(_SYS_STR(" %s\n"), item.getRelativePath().data());
|
||||
fmt::print(fmt(_SYS_STR(" {}\n")), item.getRelativePath());
|
||||
fflush(stdout);
|
||||
|
||||
if (continuePrompt()) {
|
||||
@@ -173,7 +173,7 @@ public:
|
||||
hecl::ClientProcess cp(&printer);
|
||||
for (const hecl::ProjectPath& path : m_selectedItems) {
|
||||
if (!m_useProj->packagePath(path, printer, m_fast, m_spec, &cp))
|
||||
LogModule.report(logvisor::Error, _SYS_STR("Unable to package %s"), path.getAbsolutePath().data());
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("Unable to package {}")), path.getAbsolutePath());
|
||||
}
|
||||
cp.waitUntilComplete();
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ public:
|
||||
return;
|
||||
|
||||
if (!info.project)
|
||||
LogModule.report(logvisor::Fatal, "hecl spec must be ran within a project directory");
|
||||
LogModule.report(logvisor::Fatal, fmt("hecl spec must be ran within a project directory"));
|
||||
|
||||
const auto& specs = info.project->getDataSpecs();
|
||||
hecl::SystemString firstArg = info.args.front();
|
||||
@@ -27,7 +27,7 @@ public:
|
||||
return;
|
||||
|
||||
if (info.args.size() < 2)
|
||||
LogModule.report(logvisor::Fatal, "Speclist argument required");
|
||||
LogModule.report(logvisor::Fatal, fmt("Speclist argument required"));
|
||||
|
||||
auto it = info.args.begin();
|
||||
++it;
|
||||
@@ -41,7 +41,7 @@ public:
|
||||
}
|
||||
}
|
||||
if (!found)
|
||||
LogModule.report(logvisor::Fatal, _SYS_STR("'%s' is not found in the dataspec registry"), it->c_str());
|
||||
LogModule.report(logvisor::Fatal, fmt(_SYS_STR("'{}' is not found in the dataspec registry")), *it);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,10 +77,10 @@ public:
|
||||
if (!m_info.project) {
|
||||
for (const hecl::Database::DataSpecEntry* spec : hecl::Database::DATA_SPEC_REGISTRY) {
|
||||
if (XTERM_COLOR)
|
||||
hecl::Printf(_SYS_STR("" BOLD CYAN "%s" NORMAL "\n"), spec->m_name.data());
|
||||
fmt::print(fmt(_SYS_STR("" BOLD CYAN "{}" NORMAL "\n")), spec->m_name);
|
||||
else
|
||||
hecl::Printf(_SYS_STR("%s\n"), spec->m_name.data());
|
||||
hecl::Printf(_SYS_STR(" %s\n"), spec->m_desc.data());
|
||||
fmt::print(fmt(_SYS_STR("{}\n")), spec->m_name);
|
||||
fmt::print(fmt(_SYS_STR(" {}\n")), spec->m_desc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -89,16 +89,16 @@ public:
|
||||
if (mode == MLIST) {
|
||||
for (auto& spec : specs) {
|
||||
if (XTERM_COLOR)
|
||||
hecl::Printf(_SYS_STR("" BOLD CYAN "%s" NORMAL ""), spec.spec.m_name.data());
|
||||
fmt::print(fmt(_SYS_STR("" BOLD CYAN "{}" NORMAL "")), spec.spec.m_name);
|
||||
else
|
||||
hecl::Printf(_SYS_STR("%s"), spec.spec.m_name.data());
|
||||
fmt::print(fmt(_SYS_STR("{}")), spec.spec.m_name);
|
||||
if (spec.active) {
|
||||
if (XTERM_COLOR)
|
||||
hecl::Printf(_SYS_STR(" " BOLD GREEN "[ENABLED]" NORMAL ""));
|
||||
fmt::print(fmt(_SYS_STR(" " BOLD GREEN "[ENABLED]" NORMAL "")));
|
||||
else
|
||||
hecl::Printf(_SYS_STR(" [ENABLED]"));
|
||||
fmt::print(fmt(_SYS_STR(" [ENABLED]")));
|
||||
}
|
||||
hecl::Printf(_SYS_STR("\n %s\n"), spec.spec.m_desc.data());
|
||||
fmt::print(fmt(_SYS_STR("\n {}\n")), spec.spec.m_desc);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -45,20 +45,20 @@ bool XTERM_COLOR = false;
|
||||
/* Main usage message */
|
||||
static void printHelp(const hecl::SystemChar* pname) {
|
||||
if (XTERM_COLOR)
|
||||
hecl::Printf(_SYS_STR("" BOLD "HECL" NORMAL ""));
|
||||
fmt::print(fmt(_SYS_STR("" BOLD "HECL" NORMAL "")));
|
||||
else
|
||||
hecl::Printf(_SYS_STR("HECL"));
|
||||
fmt::print(fmt(_SYS_STR("HECL")));
|
||||
#if HECL_HAS_NOD
|
||||
#define TOOL_LIST "extract|init|cook|package|image|help"
|
||||
#else
|
||||
#define TOOL_LIST "extract|init|cook|package|help"
|
||||
#endif
|
||||
#if HECL_GIT
|
||||
hecl::Printf(_SYS_STR(" Commit " HECL_GIT_S " " HECL_BRANCH_S "\nUsage: %s " TOOL_LIST "\n"), pname);
|
||||
fmt::print(fmt(_SYS_STR(" Commit " HECL_GIT_S " " HECL_BRANCH_S "\nUsage: {} " TOOL_LIST "\n")), pname);
|
||||
#elif HECL_VER
|
||||
hecl::Printf(_SYS_STR(" Version " HECL_VER_S "\nUsage: %s " TOOL_LIST "\n"), pname);
|
||||
fmt::print(fmt(_SYS_STR(" Version " HECL_VER_S "\nUsage: {} " TOOL_LIST "\n")), pname);
|
||||
#else
|
||||
hecl::Printf(_SYS_STR("\nUsage: %s " TOOL_LIST "\n"), pname);
|
||||
fmt::print(fmt(_SYS_STR("\nUsage: {} " TOOL_LIST "\n")), pname);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -77,11 +77,9 @@ static void SIGINTHandler(int sig) {
|
||||
}
|
||||
|
||||
static logvisor::Module AthenaLog("Athena");
|
||||
static void AthenaExc(athena::error::Level level, const char* file, const char*, int line, const char* fmt, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
AthenaLog.report(logvisor::Level(level), fmt, ap);
|
||||
va_end(ap);
|
||||
static void AthenaExc(athena::error::Level level, const char* file, const char*, int line,
|
||||
fmt::string_view fmt, fmt::format_args args) {
|
||||
AthenaLog.vreport(logvisor::Level(level), fmt, args);
|
||||
}
|
||||
|
||||
static hecl::SystemChar cwdbuf[1024];
|
||||
@@ -96,7 +94,7 @@ int main(int argc, const char** argv)
|
||||
#endif
|
||||
{
|
||||
if (argc > 1 && !hecl::StrCmp(argv[1], _SYS_STR("--dlpackage"))) {
|
||||
printf("%s\n", HECL_DLPACKAGE);
|
||||
fmt::print(fmt("{}\n"), HECL_DLPACKAGE);
|
||||
return 100;
|
||||
}
|
||||
|
||||
@@ -278,7 +276,7 @@ int main(int argc, const char** argv)
|
||||
else {
|
||||
FILE* fp = hecl::Fopen(argv[1], _SYS_STR("rb"));
|
||||
if (!fp)
|
||||
LogModule.report(logvisor::Error, _SYS_STR("unrecognized tool '%s'"), toolName.c_str());
|
||||
LogModule.report(logvisor::Error, fmt(_SYS_STR("unrecognized tool '{}'")), toolName);
|
||||
else {
|
||||
/* Shortcut-case: implicit extract */
|
||||
fclose(fp);
|
||||
@@ -295,8 +293,7 @@ int main(int argc, const char** argv)
|
||||
}
|
||||
|
||||
if (info.verbosityLevel)
|
||||
LogModule.report(logvisor::Info, _SYS_STR("Constructed tool '%s' %d\n"), tool->toolName().c_str(),
|
||||
info.verbosityLevel);
|
||||
LogModule.report(logvisor::Info, fmt(_SYS_STR("Constructed tool '{}' {}\n")), tool->toolName(), info.verbosityLevel);
|
||||
|
||||
/* Run tool */
|
||||
ErrorRef = logvisor::ErrorCount;
|
||||
|
||||
Reference in New Issue
Block a user