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

feat: Support required options; Support default option values #62

Merged
merged 2 commits into from
Nov 10, 2022

Conversation

TekWizely
Copy link
Owner

@TekWizely TekWizely commented Nov 10, 2022

feat: Adds support for Required options

OPTION NAME ! ...

feat: Adds required indicator on option help screen

-s, --long <value> (required)

feat: Adds error messaging when required options not provided

feat: Adds support for Default option values

OPTION NAME ?= DEFAULT ...

feat: Adds default indicator on option help screen

-s, --long <value> (default: DEFAULT)

feat: For boolean options, a default value ALWAYS implies 'true'

  • Will show configured default in help text

    OPTION BOOL ?= enabled -b, --bool

    -b, --bool (default: enabled)

  • Variable will be set to TRUE ("1") unless set to false via CLI

    --bool=false | f | 0

feat: Adds support for explicitly marking option as Optional

OPTION NAME ? ...
  • Added mostly to offer parity to '!'

chore: Renames config option Value to Example

chore: Removes unused interfaces / methods from command.go

chore: Processes option variable assignments in the order they are defined

  • Should not have any observable difference from previous behavior

TODO:

  • Update Docs

Fixes #61

cc: @nikolay Care to give this a try?

feat: Adds support for Required options

    OPTION NAME ! ...

feat: Adds required indicator on option help screen

    -s, --long <value> (required)

feat: Adds error messaging when required options not provided

feat: Adds support for Default option values

    OPTION NAME ?= DEFAULT ...

feat: Adds default indicator on option help screen

    -s, --long <value> (default: DEFAULT)

feat: For boolean options, a default value ALWAYS implies 'true'

  - Will show configured default in help text

    OPTION BOOL ?= enabled -b, --bool
    -b, --bool (default: enabled)

  - Variable will be set to TRUE ("1") unless set to false via CLI

    --bool=false | f | 0

feat: Adds support for explicitly marking option as Optional

    OPTION NAME ? ...

  - Added mostly to offer parity to '!'

chore: Renames config option Value to Example

chore: Removes unused interfaces / methods from command.go

chore: Processes option variable assignments in the order they are defined
  - Should not have any observable difference from previous behavior
@nikolay
Copy link

nikolay commented Nov 10, 2022

@TekWizely I tested and both worked fine for me! I can't wait to start using this!

@TekWizely TekWizely merged commit 5f5fed2 into master Nov 10, 2022
@TekWizely TekWizely deleted the feat/options-required-default branch November 10, 2022 19:06
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.

Required options and default option values
2 participants