Welcome
OptionParser
is a set of classes to handle parsing command line parameters given to
a Xojo application. OptionParser
handles all three application
types:
- Desktop
- Console
- Web
Downloading
To download the latest release of OptionParser
visit the
Releases page on GitHub.
To download the latest bleeding edge development version, please fork/clone the GitHub repository xojo-option-parser.
Getting Started
To get started, simply include the .xojo_xml_code
files in your project, populate
the OptionParser
with a few Option
's and call .Parse(args)
:
Dim opt As New OptionParser
opt.AddOption New Option("v", "verbose", "Enable verbose output", Option.OptionType.Boolean)
opt.AddOption New Option("f", "file", "File to parse", Option.OptionType.File)
opt.Parse(args) // System.CommandLine for GUI/Web
If opt.BooleanValue("verbose") Then // could access as "v" as well
Print "Verbosity is on!"
End If
Dim fh As FolderItem = opt.FileValue("file")
// Do work with fh
How to Help
When using OptionParser
in your own applications, if you run into a bug:
- At bare minimum, submit a bug report at github/jcowgar/xojo-option-parser/issues.
- Better yet, fork the repo, fix the bug and submit a pull request, github/jcowgar/xojo-option-parser/fork.
- Best, fork the repo, add a unit test exposing the bug, fix the bug, and then submit a pull request (see #2).