8000 Optparse v2 by bitwes · Pull Request #623 · bitwes/Gut · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Optparse v2 #623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Jun 11, 2024
Merged

Optparse v2 #623

merged 12 commits into from
Jun 11, 2024

Conversation

bitwes
Copy link
Owner
@bitwes bitwes commented Jun 10, 2024

I wanted a better optparse to use in other places so I beefed up the one GUT uses. If you need to parse command line options you can copy addons/gut/cli/optparse.gd. It has no dependencies in GUT. See scratch/optparse_example.gd for some usage examples.

Changes for GUT

  • options that take a value can now be specified with a space (option value) instead of using option=value.
  • -gh option now has headings for the different options. It looks a lot better.
  • -gdir and -gtest can be specified multiple times instead of using a comma delimited list.

Changes to optparse.gd

  • A giant amount of documentation added to the top of optparse.gd. Read that for full info about usage.
  • Supports headings to group like options together.
  • Supports positional options.
  • Parses values that follow an option. Using option=value is now an optional way to specify an option value.
  • Empty array values can now be specified with option=. Before you would always get [''] as the value.
  • Generates "Usage" section in the help.
  • Boolean options can default to true and will be set to false if specified.
  • Looks like I forgot to test optparse.gd originally, it now has a full set of tests.
  • Array values are appended if specified multiple times.

@bitwes bitwes merged commit f5dd27a into main Jun 11, 2024
@bitwes bitwes deleted the optparse_v2 branch June 11, 2024 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant
0