Scenario:
I have an enum as follows, where the value of this enum should come from command line.
enum {red=0, yellow=3, blue} color_e;
To acheive that, an user is permitted provide plusargs at command line in both of the following ways.
Way 1: set by name
+COLOR=yellow
Way 2: set by number
+COLOR=3
Capture cmd line value for way 1 (as string)
$value$plusargs("COLOR=%s", str_color);
enum_wrapper::from_name(str_color, color_e)
Capture cmd line value for way 2: (as int)
$value$plusargs("COLOR=%0d", int_color);
$cast(color_e, int_color);
Query:
How do I write the code that would allow me to capture command line value whichever way (by name or number) it is provided?