enaml-ops / omg-cli

it's kind of like an (o)ps (m)anager in (g)olang
Apache License 2.0
15 stars 11 forks source link

validation of parameters #36

Open haydonryan opened 8 years ago

haydonryan commented 8 years ago

It'd be really nice if the CLI performed validation on two use cases (fast feedback to user):

  1. if you specify a flag, but don't specify a parameter.
  2. if you repeat parameters (especially likely in creating a complex cloud config)
haydonryan commented 8 years ago

for example due to stupidity I tried:

omg deploy-cloudconfig \

--bosh-url https://10.0.16.6 --bosh-port 25555 \ --bosh-user admin --bosh-pass cat director.pwd --ssl-ignore \ aws-cloudconfigplugin-linux \ --aws-region us-west-1 \ --aws-security-group \ --bosh-az-name-1 public \ --cidr-1 10.0.0.0/24 \ --gateway-1 10.0.0.1 \ --dns-1 10.0.0.2 \ --aws-az-name-1 us-west-1b \ --aws-subnet-name-1 subnet-X \ --bosh-reserve-range-1 "10.0.0.1-10.0.0.10" \ --bosh-az-name-1 private \ --cidr-1 10.0.16.0/20 \ --gateway-1 10.0.16.1 \ --dns-1 10.0.16.2 \ --aws-az-name-1 us-west-1b \ --aws-subnet-name-1 subnet-X \ --bosh-reserve-range-1 "10.0.16.1-10.0.16.10" 400 Bad Request error pushing cloud config to BOSH: {"code":40001,"description":"Required property 'networks' was not specified in object ({})"}

zmb3 commented 8 years ago

These are limitations of the CLI library we use, which make it tricky for us to fix downstream. For example, in case 2 above, by the time the flags get to us the library has already picked the last use of a flag (we don't even see that it was supplied more than once). We should file issues upstream: https://github.com/urfave/cli

haydonryan commented 8 years ago

Ok want me to do that?