December 2017
Intermediate to advanced
316 pages
6h 58m
English
This is the next step for a Go developer after playing with the flag package. It provides an intuitive API for creating command-line applications with ease. It allows us to collect arguments and flags. It could be quite handy for designing complex applications. To install the package, use the following command:
go get github.com/urfave/cli
After that, let us write a program that does exactly the same job as the preceding programs:
cli/cliBasic.go:
package main import ( "log" "os" "github.com/urfave/cli" ) func main() { // Create new app app := cli.NewApp() // add flags with three arguments app.Flags = []cli.Flag { cli.StringFlag{ Name: "name", Value: "stranger", Usage: "your wonderful name", ...Read now
Unlock full access