urfave-cli

command
v0.0.0-...-fdc33b6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 18, 2020 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

[urfave-cli](https://github.com/urfave/cli) is a popular CLI package. In this example we will show how to use it to create flags, sub commands and act on them. godoc: [https://godoc.org/github.com/urfave/cli](https://godoc.org/github.com/urfave/cli)

urfave-cli example #1 See how different App properties show up in -h

urfave-cli example #2 Accessing non-flag arguments with c.Args()

urfave-cli example #3 Sets flags host and port then prints host:port.

urfave-cli example #4 Using sub commands to hack the planet! Usually when using subcommands we pass/read another non-flag argument

urfave-cli example #5 Showing subcommand categories and using cli.Context passed to Action func. This time we are using the same function for Action of all sub commands and then grabbing the subcommand in the function.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL