rliebz / tusk

The modern task runner
https://rliebz.github.io/tusk/
MIT License
237 stars 21 forks source link

Support for conditional requirement of options #65

Open Hobart2967 opened 4 years ago

Hobart2967 commented 4 years ago

Is your feature request related to a problem? Please describe. Depending on the options and args given I'd like to require additional options. For example, I have a build task that requires an option "name" in some cases, but not in all.

The structure for "when" in tasks is great already and looks suitable to the requiring of options, too.

Describe the solution you'd like

# ...
  build:
    usage: Builds a part of this product 
    args:
      artifact:
        usage: "Type of artifact to build"
        values:
          - app
          - lib
    options:
      name:
        usage: Name of the target to build
        required:
          when:
            - { artifact: 'lib' }
# ....