metaforce/hecl/driver/ToolHelp.hpp

103 lines
3.7 KiB
C++
Raw Normal View History

2015-06-10 02:40:03 +00:00
#ifndef CTOOL_HELP
#define CTOOL_HELP
#include "ToolBase.hpp"
#include <stdio.h>
#include <functional>
class ToolHelp final : public ToolBase
{
public:
ToolHelp(const ToolPassInfo& info)
: ToolBase(info)
{
if (m_info.args.empty())
2015-07-26 02:52:02 +00:00
{
LogModule.report(LogVisor::Error, "help requires a tool name argument");
return;
}
m_good = true;
2015-06-10 02:40:03 +00:00
}
~ToolHelp()
{
}
static void Help(HelpOutput& help)
{
2015-07-22 19:14:50 +00:00
help.printBold(
2015-07-26 02:52:02 +00:00
_S(" ___________ \n")
_S(" ,.-'\"...........``~., \n")
_S(" ,.-\".......................\"-., \n")
_S(" ,/..................................\":, \n")
_S(" .,?........................................, \n")
_S(" /...........................................,}\n")
_S(" ./........................................,:`^`..}\n")
_S(" ./.......................................,:\"...../\n")
_S(" ?.....__..................................:`...../\n")
_S(" /__.(...\"~-,_...........................,:`....../\n")
_S(" /(_....\"~,_....\"~,_.....................,:`...._/ \n")
_S(" {.._$;_....\"=,_.....\"-,_......,.-~-,},.~\";/....} \n")
_S(" ((...*~_......\"=-._...\";,,./`........../\"..../ \n")
_S(" ,,,___.`~,......\"~.,....................`......}....../ \n")
2015-07-22 19:14:50 +00:00
_S("............(....`=-,,...`.........................(...;_,,-\" \n")
_S("............/.`~,......`-.................................../ \n")
_S(".............`~.*-,.....................................|,./...,__ \n")
_S(",,_..........}.>-._...................................|.......`=~-, \n")
_S(".....`=~-,__......`,................................. \n")
_S("...................`=~-,,.,........................... \n")
_S(".........................`:,,..........................`\n")
_S("...........................`=-,...............,%%`>--==`` \n")
_S(".................................._.........._,-%%...` \n")
_S("...................................,\n"));
2015-06-10 02:40:03 +00:00
}
static void ShowHelp(const HECL::SystemString& toolName)
{
/* Select tool's help-text streamer */
HelpOutput::HelpFunc helpFunc = NULL;
if (toolName == _S("init"))
helpFunc = ToolInit::Help;
else if (toolName == _S("spec"))
helpFunc = ToolSpec::Help;
2015-06-12 09:08:49 +00:00
else if (toolName == _S("extract"))
helpFunc = ToolExtract::Help;
2015-06-10 02:40:03 +00:00
else if (toolName == _S("add"))
helpFunc = ToolAdd::Help;
else if (toolName == _S("remove") || toolName == _S("rm"))
helpFunc = ToolRemove::Help;
else if (toolName == _S("group"))
helpFunc = ToolGroup::Help;
else if (toolName == _S("cook"))
helpFunc = ToolCook::Help;
else if (toolName == _S("clean"))
helpFunc = ToolClean::Help;
else if (toolName == _S("package") || toolName == _S("pack"))
helpFunc = ToolPackage::Help;
else if (toolName == _S("help"))
helpFunc = ToolHelp::Help;
else
{
2015-07-26 02:52:02 +00:00
LogModule.report(LogVisor::Error, _S("unrecognized tool '%s' - can't help"), toolName.c_str());
2015-06-10 02:40:03 +00:00
return;
}
HelpOutput ho(helpFunc);
ho.go();
}
HECL::SystemString toolName() const {return _S("help");}
int run()
{
ShowHelp(m_info.args[0]);
return 0;
}
};
#endif // CTOOL_HELP