mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: ignore lone dash on the command-line (issue #553)
- can inadvertently arise from TAB-completion, but an option without a name doesn't make sense, we trap this and emit a warning.
This commit is contained in:
@ -480,6 +480,7 @@ Foam::argList::argList
|
|||||||
|
|
||||||
// Check arguments and options, argv[0] was already handled
|
// Check arguments and options, argv[0] was already handled
|
||||||
int nArgs = 1;
|
int nArgs = 1;
|
||||||
|
HashTable<string>::const_iterator optIter;
|
||||||
for (int argI = 1; argI < args_.size(); ++argI)
|
for (int argI = 1; argI < args_.size(); ++argI)
|
||||||
{
|
{
|
||||||
argListStr_ += ' ';
|
argListStr_ += ' ';
|
||||||
@ -489,15 +490,20 @@ Foam::argList::argList
|
|||||||
{
|
{
|
||||||
const char *optionName = &args_[argI][1];
|
const char *optionName = &args_[argI][1];
|
||||||
|
|
||||||
if
|
if (!*optionName)
|
||||||
|
{
|
||||||
|
Warning
|
||||||
|
<<"Ignoring lone '-' on the command-line" << endl;
|
||||||
|
}
|
||||||
|
else if
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
validOptions.found(optionName)
|
(optIter = validOptions.cfind(optionName)).found()
|
||||||
&& !validOptions[optionName].empty()
|
&& !optIter.object().empty()
|
||||||
)
|
)
|
||||||
|| (
|
|| (
|
||||||
validParOptions.found(optionName)
|
(optIter = validParOptions.cfind(optionName)).found()
|
||||||
&& !validParOptions[optionName].empty()
|
&& !optIter.object().empty()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user