mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-25 07:40:03 +02:00
fix for multi_id and commands starting with h
This commit is contained in:
parent
a961eead24
commit
3100ca448e
@ -25,9 +25,11 @@ void CmdParser::Parse(std::string s) {
|
|||||||
// taking s by value we can modify it.
|
// taking s by value we can modify it.
|
||||||
Reset();
|
Reset();
|
||||||
|
|
||||||
// Are we looking at -h --help?
|
// Are we looking at -h --help? avoid removing h from command starting
|
||||||
|
// with h when combined with detector id (ex, 1-hostname)
|
||||||
bool h = replace_first(&s, "--help", " ");
|
bool h = replace_first(&s, "--help", " ");
|
||||||
h = h || replace_first(&s, "-h", " ");
|
h = h || replace_first(&s, " -h", " ");
|
||||||
|
h = h || replace_first(&s, "-h ", " ");
|
||||||
help_ = h;
|
help_ = h;
|
||||||
|
|
||||||
// Extract the position indicies
|
// Extract the position indicies
|
||||||
|
@ -384,3 +384,13 @@ TEST_CASE("All stuff"){
|
|||||||
REQUIRE(p.multi_id() == 3);
|
REQUIRE(p.multi_id() == 3);
|
||||||
REQUIRE(p.command() == "exptime");
|
REQUIRE(p.command() == "exptime");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_CASE("Parse a command that has -h in it"){
|
||||||
|
CmdParser p;
|
||||||
|
p.Parse("1-hostname somepc");
|
||||||
|
REQUIRE(p.multi_id() == 1);
|
||||||
|
REQUIRE(p.command() == "hostname");
|
||||||
|
REQUIRE(p.arguments().size() == 1);
|
||||||
|
REQUIRE(p.arguments()[0]== "somepc");
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user