hi i wrote this code to get parameters from the CLI, but I would like to modify it to make possible also to get those parameters from a json.
type Options struct {
one *string
two *string
three *string
}
func ParseOptions() (Options) {
opt := Options {
one : flag.String(...),
two : flag.String(....),
three : flag.String(...),
}
flag.Parse()
return opt
}
how can I make it, should i first ask for example to enter 1 if take in input things from cli and 2 from a json? the how should i decode/parse the json?
thx
What do you mean by “from a JSON”? Do you parse a JSON file? Then you should give the path to this file as a flag.String, read the file and parse it.