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

Validate script arguments #43

Merged
merged 2 commits into from
Jul 16, 2019
Merged

Conversation

Crevil
Copy link
Member

@Crevil Crevil commented Jul 11, 2019

If a user provides unknown arguments to a script this is silently ignored.

This can lead to time consuming typos, e.g. versoin instead of version.

This change set ensures that no unknown arguments can be applied to a script. It also detects all errors before stopping execution so unknown arguments, missing required arguments and non-parsable arguments are reported in one go.

$ shuttle --project examples/moon-base run required-arg b=1 d
shuttle failed
Arguments not valid:
 'd' not <argument>=<value>
 'a' not supplied but is required
 'b' unknown

Script 'required-arg' accepts the following arguments:
  a (required)

Lastly acceptable arguments are printed on any of the above errors to help users detect their mistakes fast.

This closes #38

If a user provides unknown arguments to a script this is silently
ignored.

This can lead to time consuming typos, e.g. 'versoin' instead of
'version'.

This change set ensures that no unknown arguments can be applied to a
script. It also detects all errors before stopping execution so unknown
arguments, missing required arguments and non-parsable arguments are
reported in one go.

$ shuttle --project examples/moon-base run required-arg b=1 d
shuttle failed
Arguments not valid:
 'd' not <argument>=<value>
 'a' not supplied but is required
 'b' unknown

Script 'required-arg' accepts the following arguments:
  a (required)

Lastly acceptable arguments are printed on any of the above errors to
help users detect their mistakes fast.
@Crevil Crevil requested a review from kaspernissen July 11, 2019 07:30
Copy link
Member

@kaspernissen kaspernissen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\lgtm

@kaspernissen kaspernissen merged commit c68e9b7 into master Jul 16, 2019
@kaspernissen kaspernissen deleted the feature/validate-script-arguments branch July 16, 2019 19:17
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.

Fail on unknown arguments
2 participants