aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/utils/name2addr.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/name2addr.cpp')
-rw-r--r--utils/name2addr.cpp45
1 files changed, 13 insertions, 32 deletions
diff --git a/utils/name2addr.cpp b/utils/name2addr.cpp
index f177c86..22c637b 100644
--- a/utils/name2addr.cpp
+++ b/utils/name2addr.cpp
@@ -23,47 +23,28 @@ namespace
{
public:
explicit Name2Addr(const std::string& argv0)
- : SettingsParser{argv0, build_options(), build_args()}
- { }
-
- bool exit_with_usage() const { return help_flag; }
-
- const char* get_short_description() const override
- {
- return "[-h|--help] [--pdb ADDR,PATH]... [--] [NAME]...";
- }
-
- std::vector<PDB> pdbs;
- std::vector<std::string> names;
-
- private:
- Options build_options()
+ : SettingsParser{argv0}
{
- namespace program_options = boost::program_options;
- Options descr{"options"};
- descr.add_options()
- ("help,h",
- program_options::bool_switch(&help_flag),
- "show this message and exit")
+ visible.add_options()
("pdb",
- program_options::value<std::vector<PDB>>(&pdbs)
+ boost::program_options::value<std::vector<PDB>>(&pdbs)
->value_name("ADDR,PATH"),
- "load a PDB file")
+ "load a PDB file");
+ hidden.add_options()
("name",
- program_options::value<std::vector<std::string>>(&names)
+ boost::program_options::value<std::vector<std::string>>(&names)
->value_name("NAME"),
"add a name to resolve");
- return descr;
+ positional.add("name", -1);
}
- static Arguments build_args()
+ const char* get_short_description() const override
{
- Arguments descr;
- descr.add("name", -1);
- return descr;
+ return "[-h|--help] [--pdb ADDR,PATH]... [--] [NAME]...";
}
- bool help_flag = false;
+ std::vector<PDB> pdbs;
+ std::vector<std::string> names;
};
void dump_error(const std::exception& e)
@@ -90,7 +71,7 @@ int main(int argc, char* argv[])
{
try
{
- const Name2Addr settings{argv[0]};
+ Name2Addr settings{argv[0]};
try
{
@@ -102,7 +83,7 @@ int main(int argc, char* argv[])
return 1;
}
- if (settings.exit_with_usage())
+ if (settings.exit_with_usage)
{
settings.usage();
return 0;