converge icon indicating copy to clipboard operation
converge copied to clipboard

Implicit parameters for switch statements

Open rebeccaskinner opened this issue 9 years ago • 1 comments

Opening this for further discussion:

It would be nice to have a parameter that we can match on for switch statements without having to include it in every predicate. For example it would be nice to be able to say:

switch "{{platform.LinuxDistribution}}" "linux-stuff" {
  case "ubuntu" "configure-ubuntu" { }
  case "redhat" "configure-redhat" { }
  case "centos" "configure-centos" { }
  default { /* generic linux configuration */ }
}

rebeccaskinner avatar Oct 21 '16 18:10 rebeccaskinner

maybe:

switch "linux-stuff" {
  of = "{{platform.LinuxDistribution}}" // a value to compare against. Better name suggestions appreciated.

  case "ubuntu" "configure-ubuntu" { }
  case "redhat" "configure-redhat" { }
  case "centos" "configure-centos" { }
  default { /* generic linux configuration */ }
}

BrianHicks avatar Oct 23 '16 19:10 BrianHicks