Skip to content

Commit 65c0a0d

Browse files
committed
Collapse family_id ifs, and add hex string to error text
1 parent 71ba962 commit 65c0a0d

1 file changed

Lines changed: 4 additions & 6 deletions

File tree

main.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,7 @@ struct family_id : public cli::value_base<family_id> {
401401
auto family_id = family_name_to_id.find(value);
402402
if (family_id != family_name_to_id.end()) {
403403
t = family_id->second;
404-
} else {
405-
if (value.find("0x") == 0) {
404+
} else if (value.find("0x") == 0) {
406405
value = value.substr(2);
407406
size_t pos = 0;
408407
long lvalue = std::numeric_limits<long>::max();
@@ -419,10 +418,9 @@ struct family_id : public cli::value_base<family_id> {
419418
return value + " is not a valid 32 bit value";
420419
}
421420
t = (unsigned int) lvalue;
422-
} else {
423-
return value + " is not a valid family ID"
424-
+ "\n\nValid family IDs are: " + cli::join(family_names, ", ");
425-
}
421+
} else {
422+
return value + " is not a valid family ID"
423+
+ "\n\nValid family IDs are: " + cli::join(family_names, ", ") + ", or hex strings starting with 0x";
426424
}
427425
return string("");
428426
});

0 commit comments

Comments
 (0)