| Start |
|---|
| Mandatory and optional command line options It's relatively easy to parse the command line by hand if you aren't looking for anything too complex: But when your options start to get more complicated, you probably will need to use an option parser such as, well, OptionParser (opens new window): There's also a non-destructive The OptionParser class doesn't have a way to enforce mandatory arguments (such as For a more generic mandatory option handler, see this answer (opens new window). In case it isn't clear, all options are optional unless you go out of your way to make them mandatory. |
| Default values With When you define the parser, it will overwrite the default if a user provide a value: |
| Long descriptions Sometimes your description can get rather long. For instance It's not immediately clear how to support this. Most solutions require adjusting to make the indentation of the second and following lines align to the first. Fortunately, the You can add as many description lines as you like to fully explain the option. |
Read Article
https://develop.horje.com/learn/1434/reference