Self in sub command
suntong opened this issue · 2 comments
suntong commented
Hiya,
Please take a look at 027s-subc.go
This is how I run it,
echo '{ "Dir": "DDD", "Suffix": "sss", "Out": "oooo" }' > build.json
$ go run 027s-subc.go build aaa
[build]:
&{Helper:{Help:false} Host: Port:80}
&{Self:0xc8200184c0 Dir:./ Suffix:.go,.c,.s Out:}
[aaa]
The Self
in sub command is supposed to pick up values defined in the build.json
file, and I surely remember it did it before, but now it seems not doing it.
mkideal commented
I'm sorry. I made a mistake when fix Reader
and Writer
, See commit 7bfc6df. And Self
should be the last field of strcutre:
type buildT struct {
Dir string `cli:"dir" usage:"source code root dir" dft:"./"`
Suffix string `cli:"suffix" usage:"source file suffix" dft:".go,.c,.s"`
Out string `cli:"o,out" usage:"output filename"`
Self *buildT `cli:"c,config" usage:"config file" json:"-" parser:"jsonfile" dft:"build.json"`
}
otherwise, the values(read from json file) will be covered by the dft
values
suntong commented
Bingo. Thanks,