In GO's Cobra, lib for making CLIs, there are two input flags accepting multiple values being passed. One of the options is StringArray
, when used as follows:
--flag=value1 --flag=value2
it yields an array ["value1", "value2"]
.
I am working on a drop-in replacement for a tool that expects somewhat more complex input:
--flag=valueA1 valueB1 --flag=valueA2 valueB2
the array it should yield would be ["valueA1 valueB1", "valueA2 valueB2"]
is there a way in cobra to parse the entire string until the next flag and include it in StringArray value like above?