Commandline Optionvalue not displayed when using special characters

Hi there,

I am creating a command, using options.

When I try to display the current value in the commandline options, the option is disappearing completely.

string variable = “#04”;
OptionToggle optionReplacee = new OptionToggle(false, variable, “OnValue”);

Does the commandline have restrictions for special characters like “#”?

Thanks,
T.

I can’t quickly find it documented but as far as I know only letters and digits are allowed. If I’m not mistaken that is because characters other than those I mentioned have often special meaning on the command-line (see Rhino scripting | Rhino 3-D modeling ). That is also why you can’t have spaces in there.

@nathanletwory, thanks.
So the strategy to make it visible then is to add a character in front.
I tried “(”, but it also does not work.
Is there an overview which special characters might work?

There is no clear documentation but the link I posted about Rhino scripting along with IsValidOptionName and IsValidOptionValueName will help you figuring out what can cannot be used.

Additionally, under the hood, these are some of the functions that do checks on validity:

static bool IsValidCommandNameLetter( wchar_t c )
{
  return ( (c >= 'a' && c <= 'z') || ( c >= 'A' && c <= 'Z' ) || c >= 128 );
}

static bool IsValidCommandNameFirstChar( wchar_t c )
{
  return ( IsValidCommandNameLetter(c) || (c >= '0' && c <= '9') );
}

static bool IsValidCommandNameSecondChar( wchar_t c )
{
  return ( IsValidCommandNameFirstChar(c) || c == '_' );
}

static bool IsValidOptionValueFirstChar( wchar_t c )
{
  return ( IsValidCommandNameFirstChar(c) || c == '.' || c == '+' || c == '-' );
}

static bool IsValidOptionValueSecondChar( wchar_t c )
{
  return ( c > 32 && c != 127 && c != '(' && c != ')' );
}

That together with the Rhino scripting documentation should get you going for now.

Thanks a lot, @nathanletwory!