Skip to content

Switches with zero or more arguments #3

@Zorgle

Description

@Zorgle

I was considering modifying the switch code to allow being able to specify a switch as taking zero or more arguments.

For example, allow either of the following to specifically set the polling option from the command line

  • "program -Polling"
  • "program -Polling on"

and allow the following to turn it off from the command line:

  • "program -Polling off"

It is going to be tricky to add new overrides to the Switch constructor, because there are already so many, and so many combinations of parameters, so I was considering just adding a static Switch constructor for this, eg,

  • "static Switch Switch:CreateOptionalArgs(string name, int minArgCount, int maxArgCount, bool isRequired)"

(I'm omitting the other parameters for simplicity of discussion.)

I would then convert "m_hasArguments" into "m_minArguments" and "m_maxArguments", and use UnknownNumberArguments for unspecified max parameter count (as it is currently).

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions