Skip to content
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

refactor flags & add missing flag base types #44

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

skaldesh
Copy link
Member

@skaldesh skaldesh commented Jan 9, 2022

This PR adds support for Flag types int8, int16, int32, uint8, uint16, uint32, float32.

The PR also streamlines and simplifies the whole flag parsing process. IMO, this makes the code easier to read and requires only 1 line now for each of the flag types to be registered in the Flags.

There is also just one type that represents the internal flag now (flagItem), where before this was splitted into the item and two funcs arcoss 3 slices.

The change is backwards compatible, so flags can still be given in the following two forms:

  • cmd --flag value
  • cmd --flag=value
  • exceptions:
    • cmd --flag for bool flags
    • cmd --flag="multi word stuff" leads to just multi word stuff being the value, for string flags.

These rules have now also been added to the README

@skaldesh skaldesh requested a review from r0l1 January 9, 2022 14:49
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.

None yet

2 participants