DEV Community

Discussion on: Diving into Go by building a CLI application

Collapse
 
suntong profile image
suntong
comicNo := flag.Int(
    "n", int(client.LatestComic), "Comic number to fetch (default latest)",
)
clientTimeout := flag.Int64(
    "t", int64(client.DefaultClientTimeout.Seconds()), "Client timeout in seconds",
)
saveImage := flag.Bool(
    "s", false, "Save image to current directory",
)
outputType := flag.String(
    "o", "text", "Print output in format: text/json",
)

The CLI interface tends to get more and more complicated as we put more functionalities into it, normally. To avoid hand-crafting the above code manually, there is a ready made tool to make things a bit easier from a .yaml definition file --
github.com/go-easygen/wireframe#co...

check it out, give it a try...