cmd:opts: Now set OptionParser::argv0 to argv[0]
This commit is contained in:
@@ -23,6 +23,7 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
std::string argv0;
|
||||||
std::string senseApiLibPath;
|
std::string senseApiLibPath;
|
||||||
std::vector<std::string> senseApiLibs;
|
std::vector<std::string> senseApiLibs;
|
||||||
std::string deviceSpecs;
|
std::string deviceSpecs;
|
||||||
|
|||||||
+4
-1
@@ -25,6 +25,9 @@ void OptionParser::parseArguments(int argc, char *argv[])
|
|||||||
{
|
{
|
||||||
int opt;
|
int opt;
|
||||||
int optionIndex = 0;
|
int optionIndex = 0;
|
||||||
|
|
||||||
|
argv0 = argv[0];
|
||||||
|
|
||||||
optind = 1; // Reset optind to 1 before parsing
|
optind = 1; // Reset optind to 1 before parsing
|
||||||
while ((opt = getopt_long(
|
while ((opt = getopt_long(
|
||||||
argc, argv, "s:d:a:p:v?", longOptions, &optionIndex)) != -1)
|
argc, argv, "s:d:a:p:v?", longOptions, &optionIndex)) != -1)
|
||||||
@@ -80,7 +83,7 @@ void OptionParser::parseArguments(int argc, char *argv[])
|
|||||||
|
|
||||||
std::string OptionParser::getUsage() const
|
std::string OptionParser::getUsage() const
|
||||||
{
|
{
|
||||||
return "Usage: program [-s|--devicespec|--spec|--devspec <device_spec>] "
|
return "Usage: " + argv0 + " [-s|--devicespec|--spec|--devspec <device_spec>] "
|
||||||
"[-d|--devfile|--devicefile <filename>] "
|
"[-d|--devfile|--devicefile <filename>] "
|
||||||
"[-a|--sense-api-lib|--senseapi <filename>] "
|
"[-a|--sense-api-lib|--senseapi <filename>] "
|
||||||
"[-p|--sense-api-path <directory>] "
|
"[-p|--sense-api-path <directory>] "
|
||||||
|
|||||||
Reference in New Issue
Block a user