shuttle icon indicating copy to clipboard operation
shuttle copied to clipboard

Validation of script arguments

Open Crevil opened this issue 6 years ago • 0 comments

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://[email protected]: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 avatar Oct 03 '18 07:10 Crevil