Closed antho1404 closed 5 years ago
Future types like Any
and Object
need to be tested as well
How do we want to represent the repeated types in cli?
Some ideas:
--data foo=[a, b, c]
--data foo.0=a --data foo.1=b --data foo.2=c
--data foo=a,b,c
--json
and not the --data
Let's see what is the simplest to implement in xpflag.NewStringToStringValue
.
I like --data foo=[a, b, c]
.
the most common way i saw in cli is:
--data foo=a,b,c
where ,
is default separator and could be changed by --data-separator
flag
--data foo=[a, b, c]
- remember that spaces here won't be allowed (because of parsing cli args) so it would become --data foo=[a,b,c]
--data foo.0=a --data foo.1=b --data foo.2=c
this one introduce complexity because someone may pass --data foo.100000=a and you have to fill previous values with zeros or return an error
I think repeated types can be supported with both -d a=1,2
& -d a=1 -d a=2
syntaxes.
And objects should be only supported with json option. Because it can be really hard to deal with nested data specially if the data has too many fields. So, in the real world, devs aren't going to use it because of the complexity anyway.
let's go with the simplest implementation!
This PR https://github.com/mesg-foundation/core/pull/679 introduced a new data type:
repeated data
This file https://github.com/mesg-foundation/core/blob/master/utils/servicecasting/cast.go doesn't do anything about repeated parameters and so the command
service execute
cannot handle repeated data with the flag--data