summaryrefslogtreecommitdiff
path: root/vendor/github.com/urfave/cli/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/urfave/cli/README.md')
-rw-r--r--vendor/github.com/urfave/cli/README.md164
1 files changed, 121 insertions, 43 deletions
diff --git a/vendor/github.com/urfave/cli/README.md b/vendor/github.com/urfave/cli/README.md
index 6096701d8..f2baef4f0 100644
--- a/vendor/github.com/urfave/cli/README.md
+++ b/vendor/github.com/urfave/cli/README.md
@@ -9,9 +9,9 @@ cli
[![top level coverage](https://gocover.io/_badge/github.com/urfave/cli?0 "top level coverage")](http://gocover.io/github.com/urfave/cli) /
[![altsrc coverage](https://gocover.io/_badge/github.com/urfave/cli/altsrc?0 "altsrc coverage")](http://gocover.io/github.com/urfave/cli/altsrc)
-**Notice:** This is the library formerly known as
-`github.com/codegangsta/cli` -- Github will automatically redirect requests
-to this repository, but we recommend updating your references for clarity.
+This is the library formerly known as `github.com/codegangsta/cli` -- Github
+will automatically redirect requests to this repository, but we recommend
+updating your references for clarity.
cli is a simple, fast, and fun package for building command line apps in Go. The
goal is to enable developers to write fast and distributable command line
@@ -141,13 +141,17 @@ discovery. So a cli app can be as little as one line of code in `main()`.
package main
import (
+ "log"
"os"
"github.com/urfave/cli"
)
func main() {
- cli.NewApp().Run(os.Args)
+ err := cli.NewApp().Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -162,6 +166,7 @@ package main
import (
"fmt"
+ "log"
"os"
"github.com/urfave/cli"
@@ -176,7 +181,10 @@ func main() {
return nil
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -200,6 +208,7 @@ package main
import (
"fmt"
+ "log"
"os"
"github.com/urfave/cli"
@@ -214,7 +223,10 @@ func main() {
return nil
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -263,6 +275,7 @@ package main
import (
"fmt"
+ "log"
"os"
"github.com/urfave/cli"
@@ -276,7 +289,10 @@ func main() {
return nil
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -292,6 +308,7 @@ package main
import (
"fmt"
+ "log"
"os"
"github.com/urfave/cli"
@@ -321,7 +338,10 @@ func main() {
return nil
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -335,6 +355,7 @@ scanned.
package main
import (
+ "log"
"os"
"fmt"
@@ -368,7 +389,10 @@ func main() {
return nil
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -389,6 +413,7 @@ For example this:
package main
import (
+ "log"
"os"
"github.com/urfave/cli"
@@ -404,7 +429,10 @@ func main() {
},
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -430,6 +458,7 @@ list for the `Name`. e.g.
package main
import (
+ "log"
"os"
"github.com/urfave/cli"
@@ -446,7 +475,10 @@ func main() {
},
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -470,6 +502,7 @@ For example this:
package main
import (
+ "log"
"os"
"sort"
@@ -513,7 +546,10 @@ func main() {
sort.Sort(cli.FlagsByName(app.Flags))
sort.Sort(cli.CommandsByName(app.Commands))
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -536,6 +572,7 @@ You can also have the default value set from the environment via `EnvVar`. e.g.
package main
import (
+ "log"
"os"
"github.com/urfave/cli"
@@ -553,7 +590,10 @@ func main() {
},
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -568,6 +608,7 @@ environment variable that resolves is used as the default.
package main
import (
+ "log"
"os"
"github.com/urfave/cli"
@@ -585,7 +626,10 @@ func main() {
},
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -601,6 +645,7 @@ You can also have the default value set from file via `FilePath`. e.g.
package main
import (
+ "log"
"os"
"github.com/urfave/cli"
@@ -617,7 +662,10 @@ func main() {
},
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -653,9 +701,9 @@ the yaml input source for any flags that are defined on that command. As a note
the "load" flag used would also have to be defined on the command flags in order
for this code snipped to work.
-Currently only the aboved specified formats are supported but developers can
-add support for other input sources by implementing the
-altsrc.InputSourceContext for their given sources.
+Currently only YAML and JSON files are supported but developers can add support
+for other input sources by implementing the altsrc.InputSourceContext for their
+given sources.
Here is a more complete sample of a command using YAML support:
@@ -668,6 +716,7 @@ package notmain
import (
"fmt"
+ "log"
"os"
"github.com/urfave/cli"
@@ -690,7 +739,10 @@ func main() {
app.Before = altsrc.InitInputSourceWithContext(flags, altsrc.NewYamlSourceFromFlagFunc("load"))
app.Flags = flags
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -716,6 +768,7 @@ package main
import (
"fmt"
+ "log"
"os"
"github.com/urfave/cli"
@@ -768,7 +821,10 @@ func main() {
},
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -784,6 +840,7 @@ E.g.
package main
import (
+ "log"
"os"
"github.com/urfave/cli"
@@ -806,7 +863,10 @@ func main() {
},
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -832,6 +892,7 @@ may be set by returning a non-nil error that fulfills `cli.ExitCoder`, *or* a
package main
import (
+ "log"
"os"
"github.com/urfave/cli"
@@ -852,7 +913,10 @@ func main() {
return nil
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -872,6 +936,7 @@ package main
import (
"fmt"
+ "log"
"os"
"github.com/urfave/cli"
@@ -903,7 +968,10 @@ func main() {
},
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -943,6 +1011,7 @@ The default bash completion flag (`--generate-bash-completion`) is defined as
package main
import (
+ "log"
"os"
"github.com/urfave/cli"
@@ -961,7 +1030,10 @@ func main() {
Name: "wat",
},
}
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -987,6 +1059,7 @@ package main
import (
"fmt"
+ "log"
"io"
"os"
@@ -1030,7 +1103,10 @@ VERSION:
fmt.Println("Ha HA. I pwnd the help!!1")
}
- cli.NewApp().Run(os.Args)
+ err := cli.NewApp().Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -1045,6 +1121,7 @@ setting `cli.HelpFlag`, e.g.:
package main
import (
+ "log"
"os"
"github.com/urfave/cli"
@@ -1057,7 +1134,10 @@ func main() {
EnvVar: "SHOW_HALP,HALPPLZ",
}
- cli.NewApp().Run(os.Args)
+ err := cli.NewApp().Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -1080,6 +1160,7 @@ setting `cli.VersionFlag`, e.g.:
package main
import (
+ "log"
"os"
"github.com/urfave/cli"
@@ -1094,7 +1175,10 @@ func main() {
app := cli.NewApp()
app.Name = "partay"
app.Version = "19.99.0"
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -1109,6 +1193,7 @@ package main
import (
"fmt"
+ "log"
"os"
"github.com/urfave/cli"
@@ -1126,7 +1211,10 @@ func main() {
app := cli.NewApp()
app.Name = "partay"
app.Version = "19.99.0"
- app.Run(os.Args)
+ err := app.Run(os.Args)
+ if err != nil {
+ log.Fatal(err)
+ }
}
```
@@ -1388,7 +1476,7 @@ func main() {
ec := cli.NewExitError("ohwell", 86)
fmt.Fprintf(c.App.Writer, "%d", ec.ExitCode())
fmt.Printf("made it!\n")
- return ec
+ return nil
}
if os.Getenv("HEXY") != "" {
@@ -1402,7 +1490,9 @@ func main() {
"whatever-values": 19.99,
}
- app.Run(os.Args)
+
+ // ignore error so we don't exit non-zero and break gfmrun README example tests
+ _ = app.Run(os.Args)
}
func wopAction(c *cli.Context) error {
@@ -1433,16 +1523,4 @@ with two leading dashes (such as **--options**) are still valid.
## Contribution Guidelines
-Feel free to put up a pull request to fix a bug or maybe add a feature. I will
-give it a code review and make sure that it does not break backwards
-compatibility. If I or any other collaborators agree that it is in line with
-the vision of the project, we will work with you to get the code into
-a mergeable state and merge it into the master branch.
-
-If you have contributed something significant to the project, we will most
-likely add you as a collaborator. As a collaborator you are given the ability
-to merge others pull requests. It is very important that new code does not
-break existing code, so be careful about what code you do choose to merge.
-
-If you feel like you have contributed to the project but have not yet been
-added as a collaborator, we probably forgot to add you, please open an issue.
+See [./CONTRIBUTING.md](./CONTRIBUTING.md)