mirror of
https://github.com/sorenisanerd/gotty.git
synced 2024-11-09 15:24:25 +00:00
Switch to urfave/cli/v2... again.
This commit is contained in:
parent
1fa987c518
commit
c3c670b954
10
go.mod
10
go.mod
@ -4,13 +4,13 @@ go 1.13
|
||||
|
||||
require (
|
||||
github.com/NYTimes/gziphandler v1.1.1
|
||||
github.com/creack/pty v1.1.7
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.0
|
||||
github.com/creack/pty v1.1.11
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.1
|
||||
github.com/fatih/structs v1.1.0
|
||||
github.com/gorilla/websocket v1.4.1
|
||||
github.com/hashicorp/go-multierror v1.0.0 // indirect
|
||||
github.com/gorilla/websocket v1.4.2
|
||||
github.com/hashicorp/go-multierror v1.1.1 // indirect
|
||||
github.com/pkg/errors v0.9.1
|
||||
github.com/urfave/cli/v2 v2.3.0
|
||||
github.com/yudai/hcl v0.0.0-20151013225006-5fa2393b3552
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae // indirect
|
||||
golang.org/x/sys v0.0.0-20210415045647-66c3f260301c // indirect
|
||||
)
|
||||
|
2
go.sum
2
go.sum
@ -44,6 +44,8 @@ golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae h1:/WDfKMnPU+m5M4xB+6x4kaepx
|
||||
golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750 h1:ZBu6861dZq7xBnG1bn5SRU0vA8nx42at4+kP07FMTog=
|
||||
golang.org/x/sys v0.0.0-20210412220455-f1c623a9e750/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210415045647-66c3f260301c h1:6L+uOeS3OQt/f4eFHXZcTxeZrGCuz+CLElgEBjbcTA4=
|
||||
golang.org/x/sys v0.0.0-20210415045647-66c3f260301c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
||||
|
19
help.go
19
help.go
@ -1,19 +0,0 @@
|
||||
package main
|
||||
|
||||
var helpTemplate = `NAME:
|
||||
{{.Name}} - {{.Usage}}
|
||||
|
||||
USAGE:
|
||||
{{.Name}} [options] <command> [<arguments...>]
|
||||
|
||||
VERSION:
|
||||
{{.Version}}{{if or .Author .Email}}
|
||||
|
||||
AUTHOR:{{if .Author}}
|
||||
{{.Author}}{{if .Email}} - <{{.Email}}>{{end}}{{else}}
|
||||
{{.Email}}{{end}}{{end}}
|
||||
|
||||
OPTIONS:
|
||||
{{range .Flags}}{{.}}
|
||||
{{end}}
|
||||
`
|
5
main.go
5
main.go
@ -22,10 +22,9 @@ func main() {
|
||||
app.Name = "gotty"
|
||||
app.Version = Version + "+" + CommitID
|
||||
app.Usage = "Share your terminal as a web application"
|
||||
app.HideHelp = true
|
||||
cli.AppHelpTemplate = helpTemplate
|
||||
|
||||
app.HideHelpCommand = true
|
||||
appOptions := &server.Options{}
|
||||
|
||||
if err := utils.ApplyDefaultValues(appOptions); err != nil {
|
||||
exit(err, 1)
|
||||
}
|
||||
|
@ -28,8 +28,9 @@ func GenerateFlags(options ...interface{}) (flags []cli.Flag, mappings map[strin
|
||||
mappings[flagName] = field.Name()
|
||||
|
||||
flagShortName := field.Tag("flagSName")
|
||||
var aliases []string
|
||||
if flagShortName != "" {
|
||||
flagName += ", " + flagShortName
|
||||
aliases = []string{flagShortName}
|
||||
}
|
||||
|
||||
flagDescription := field.Tag("flagDescribe")
|
||||
@ -41,12 +42,14 @@ func GenerateFlags(options ...interface{}) (flags []cli.Flag, mappings map[strin
|
||||
Value: field.Value().(string),
|
||||
Usage: flagDescription,
|
||||
EnvVars: []string{envName},
|
||||
Aliases: aliases,
|
||||
})
|
||||
case reflect.Bool:
|
||||
flags = append(flags, &cli.BoolFlag{
|
||||
Name: flagName,
|
||||
Usage: flagDescription,
|
||||
EnvVars: []string{envName},
|
||||
Aliases: aliases,
|
||||
})
|
||||
case reflect.Int:
|
||||
flags = append(flags, &cli.IntFlag{
|
||||
@ -54,6 +57,7 @@ func GenerateFlags(options ...interface{}) (flags []cli.Flag, mappings map[strin
|
||||
Value: field.Value().(int),
|
||||
Usage: flagDescription,
|
||||
EnvVars: []string{envName},
|
||||
Aliases: aliases,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user