mumoshu / variant2

Turn your bash scripts into a modern, single-executable CLI app today
MIT License
141 stars 11 forks source link

wip: add validargs for param validation #54

Open tuananh opened 2 years ago

tuananh commented 2 years ago

Allow param validation with validargs

needs a workaround for this issue in cobra https://github.com/spf13/cobra/issues/745\

i think i need to fix more case for other type (int , list, etc...) but what do you think about this feature?

job "echo" {
  parameter "color" {
    type = string
    validargs = ["red", "yellow"]
  }

  exec {
    command = "echo"
    args = [param.color]
  }
}

Signed-off-by: Tuan Anh Tran me@tuananh.org

mumoshu commented 2 years ago

@tuananh Looks awesome!