I need a little help on how I can enforce the following constraints on the arguments to a powershell script. Can I specify these constraints with in the param section.
- At least one argument constraint
- At most one argument constraint
For example, (just an example, it's not what I am doing) to a script called ReadPlainText.ps1, I would like to give only either of the two arguments: Lines or Chars, but not both. The command ReadPlainText.ps1 Sample.txt -Lines 20 -Chars 10 should result in an error. Similarly, the command ReadPlainText.ps1 Sample.txt should result in error.