Dear All,<br><br>I am trying to read the command line arguments using &quot;metaCommand.h&quot; available in ITK.<br>I am facing problem when I am trying to collect all the information till the next tag, using the function:<br>

void SetOptionComplete(METAIO_STL::string optionName, bool complete);<br><br>Please find below a simple example-code that reproduces my problem:<br><br><b>The command line input is:</b><br>example.exe -a x1.mhd x2.mhd -o output.mhd -b y1.mhd y2.mhd<br>

<br><b>What I expected/wanted as the output from that program is:</b><br>Output file name: output.mhd<br>First list names:  x1.mhd x2.mhd<br>Second list names: y1.mhd y2.mhd<br><br><b>BUT, instead, the output that I got is:</b><br>

Output file name: output.mhd<br>
First list names:  x1.mhd x2.mhd<br>
Second list names: x1.mhd x2.mhd y1.mhd y2.mhd<br><br>Did I miss something?<br><b>Can you kindly  tell me how I should modify the below code so that<br>I could get my desired output, as mentioned above?</b><br>
<br>Thank you in advance for your help.<br><br>Warm Regards,<br>Subrahmanyam Gorthi.<br><br><b>Here is the code:</b><br><br>#include&lt;iostream&gt;<br>#include &lt;string&gt;<br>#include &quot;metaCommand.h&quot;<br><br>

int main( int argc, char *argv[] )<br>{<br>  MetaCommand command;<br><br>  // Output-file-name<br>  command.SetOption(&quot;OutputFile1&quot;, &quot;o&quot;, true, &quot;Output file name&quot;);<br>  command.AddOptionField(&quot;OutputFile1&quot;, &quot;fileName1&quot;, MetaCommand::STRING, true);<br>

<br>  // Input list1<br>  command.SetOption(&quot;InputList1&quot;, &quot;a&quot;, true, &quot;This is the first input list&quot;);<br>  command.AddOptionField(&quot;InputList1&quot;, &quot;list1&quot;, MetaCommand::STRING, true);<br>

  command.SetOptionComplete(&quot;InputList1&quot;, true);<br><br>  // Input list2<br>  command.SetOption(&quot;InputList2&quot;, &quot;b&quot;, true, &quot;This is the second input list&quot;);<br>  command.AddOptionField(&quot;InputList2&quot;, &quot;list2&quot;, MetaCommand::STRING, true);<br>

  command.SetOptionComplete(&quot;InputList2&quot;, true);<br><br>  // Now, Parse the command line<br>  if (!command.Parse(argc,argv))<br>    {<br>    exit( EXIT_FAILURE );<br>    }<br><br>  std::cout &lt;&lt; &quot;Output file name:  &quot; &lt;&lt; command.GetValueAsString(&quot;OutputFile1&quot;, &quot;fileName1&quot;) &lt;&lt; std::endl;<br>

  std::cout &lt;&lt; &quot;First list names:  &quot; &lt;&lt; command.GetValueAsString(&quot;InputList1&quot;, &quot;list1&quot;) &lt;&lt; std::endl;<br>  std::cout &lt;&lt; &quot;Second list names: &quot; &lt;&lt; command.GetValueAsString(&quot;InputList2&quot;, &quot;list2&quot;) &lt;&lt; std::endl;<br>

<br>  return EXIT_SUCCESS;<br>}<br><br>