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

Validation of script arguments #15

Open
Crevil opened this issue Oct 3, 2018 · 0 comments
Open

Validation of script arguments #15

Crevil opened this issue Oct 3, 2018 · 0 comments
Labels
enhancement New feature or request

Comments

@Crevil
Copy link
Member

Crevil commented Oct 3, 2018

If would be great if arguments for scripts were validated before issuing the command.

It would require some syntax for writing requirements of an argument in a plan. This could very well be the same syntax required for #6 for validating the plan schema.

This could add more descriptive help messages as well (#14) as we define what values are allowed up front.

Example

A naive implementation would be something like below with key validation on the argument.

plan: git://git@bitbucket.org:LunarWay/lw-shuttle-go-plan.git
scripts:
  my_script:
    description: a description
    args:
    - name: foo
      required: true
      validation:
        - someValue
        - someOtherValue
    actions:
    - shell: './run.sh'
$ shuttle run my_script foo=someWrongValue
Argument foo contains an invalid value "someWrongValue". Allowed values: "someValue", "someOtherValue"
@Crevil Crevil added the enhancement New feature or request label Oct 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant