|
|
@ -983,6 +983,9 @@ func main() {
|
|
|
|
**NOTE**: This is a contrived (functioning) example meant strictly for API
|
|
|
|
**NOTE**: This is a contrived (functioning) example meant strictly for API
|
|
|
|
demonstration purposes. Use of one's imagination is encouraged.
|
|
|
|
demonstration purposes. Use of one's imagination is encouraged.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- {
|
|
|
|
|
|
|
|
"output": "made it!\nPhew!"
|
|
|
|
|
|
|
|
} -->
|
|
|
|
``` go
|
|
|
|
``` go
|
|
|
|
package main
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
|
@ -992,6 +995,7 @@ import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
"io"
|
|
|
|
"io"
|
|
|
|
"io/ioutil"
|
|
|
|
"io/ioutil"
|
|
|
|
|
|
|
|
"os"
|
|
|
|
"time"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/urfave/cli"
|
|
|
|
"github.com/urfave/cli"
|
|
|
@ -1100,7 +1104,7 @@ func main() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
app.Flags = []cli.Flag{
|
|
|
|
app.Flags = []cli.Flag{
|
|
|
|
cli.BoolFlag{Name: "fancy"},
|
|
|
|
cli.BoolFlag{Name: "fancy"},
|
|
|
|
cli.BoolTFlag{Name: "fancy"},
|
|
|
|
cli.BoolTFlag{Name: "fancier"},
|
|
|
|
cli.StringFlag{Name: "dance-move, d"},
|
|
|
|
cli.StringFlag{Name: "dance-move, d"},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
app.EnableBashCompletion = true
|
|
|
|
app.EnableBashCompletion = true
|
|
|
@ -1150,8 +1154,13 @@ func main() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
c.App.Command("doo")
|
|
|
|
c.App.Command("doo")
|
|
|
|
|
|
|
|
if c.Bool("infinite") {
|
|
|
|
c.App.Run([]string{"app", "doo", "wop"})
|
|
|
|
c.App.Run([]string{"app", "doo", "wop"})
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if c.Bool("forevar") {
|
|
|
|
c.App.RunAsSubcommand(c)
|
|
|
|
c.App.RunAsSubcommand(c)
|
|
|
|
|
|
|
|
}
|
|
|
|
c.App.Setup()
|
|
|
|
c.App.Setup()
|
|
|
|
c.App.VisibleCategories()
|
|
|
|
c.App.VisibleCategories()
|
|
|
|
c.App.VisibleCommands()
|
|
|
|
c.App.VisibleCommands()
|
|
|
@ -1195,14 +1204,19 @@ func main() {
|
|
|
|
|
|
|
|
|
|
|
|
ec := cli.NewExitError("ohwell", 86)
|
|
|
|
ec := cli.NewExitError("ohwell", 86)
|
|
|
|
fmt.Fprintf(c.App.Writer, "%d", ec.ExitCode())
|
|
|
|
fmt.Fprintf(c.App.Writer, "%d", ec.ExitCode())
|
|
|
|
|
|
|
|
fmt.Printf("made it!\n")
|
|
|
|
return ec
|
|
|
|
return ec
|
|
|
|
}
|
|
|
|
}
|
|
|
|
app.Writer = &hexWriter{}
|
|
|
|
app.Writer = &hexWriter{}
|
|
|
|
|
|
|
|
// just kidding there
|
|
|
|
|
|
|
|
app.Writer = os.Stdout
|
|
|
|
app.ErrWriter = &hexWriter{}
|
|
|
|
app.ErrWriter = &hexWriter{}
|
|
|
|
app.Metadata = map[string]interface{}{
|
|
|
|
app.Metadata = map[string]interface{}{
|
|
|
|
"layers": "many",
|
|
|
|
"layers": "many",
|
|
|
|
"explicable": false,
|
|
|
|
"explicable": false,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
app.Run(os.Args)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func wopAction(c *cli.Context) error {
|
|
|
|
func wopAction(c *cli.Context) error {
|
|
|
|