Open YouriT opened 7 years ago
I double checked the code, it does not appear to be supported at all. This code I wrote a while back so... I may miss something.
Can you test linked commit ? It adds support for "text", "boolean" and complex types. For complex types, you can pass it encoded as json like --networks '[{}, {}, ...]'
.
Using json is not ideal but I have no idea how to support arrays of structures without it. For simple arrays, I could just allow the argument to be repeated multiple times. For structures we could imagine some kind of "dot notation". But the mix of both is not trivial. And AFAIK, few people are using this code anyway...
Works fine, merci bien !
Indeed it would require some additional work from your side and therefore this way is a good "hack" to achieve the purpose I was aiming to.
If you want a suggestion for the arguments, would use the standard JS notation which is pretty straightforward and avoids confusion on what will be the output like this:
./ovh-eu \
--networks[0].networkId 89YT8675FB
--networks[1].networkId R79090I969Y # order doesn't matter
--networks[0].otherVariable value
# would result in
[{"networkId":"89YT8675FB","otherVariable":"value"},{"networkId":"R79090I969Y"}]
Are you yourself using this module?
P.S.: Can you merge the change?
Hi,
The changed is merged. I really like your proposition. It feels clean and standard. The bad news is, there is no way I can parse it with argparse so I'll need to find / write another parser and... that's a pain. sight.
I use the api.ovh.com/console interface by default and use the CLI when I don't have my 2 factor auth device nearby :)
OK, here is a slight improvement:
--arg 1 --arg 2 ...
--complex '{"key": "value 1"}' --complex '{"key": "value 2"}' ...
This is not yet the best / perfect way. But that's as far as I can go without rewriting argparse. Which I sadly don't have the time to do...
@yadutaf thanks a lot anyhow, it's way better than nothing :) 👍 👍
Great job, it's a nice wrapper :)
I was just wondering how do you pass an array with the cli?
For example the call on
./ovh-eu cloud project PROJECT_ID instance create
can take --networks which is an array containing objects that containnetworkId
but I've no clue on how to pass that.Any hints would be lovely!