mkideal / cli

CLI - A package for building command line app with go
MIT License
730 stars 43 forks source link

How to add default flag for jsonfile? #36

Closed nerdneilsfield closed 6 years ago

nerdneilsfield commented 7 years ago

I try to use this one:

JSON config `cli:"c,config" usage:"parse json from file" parser:"jsonfile" dft: "config.json"`
suntong commented 7 years ago

Is

https://github.com/suntong/lang/blob/master/lang/Go/src/sys/CLI/027-global-option.go#L21

what you were looking for?

Or you were just trying to do this...?

https://github.com/suntong/lang/tree/master/lang/Go/src/sys/CLI#017-jsonfilego

nerdneilsfield commented 7 years ago

I'll try...

谢谢

mkideal commented 6 years ago

dft: "config.json" should be changed to dft:"config.json". NOTE: no extra space character!!

suntong commented 6 years ago

That's the final answer. Closing it now and feel free to reopen if you have any more questions.