mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-04-15 08:30:36 +03:00
main: Add extraHelp
This commit is contained in:
parent
6e9705faf5
commit
99d303e196
@ -30,18 +30,31 @@ var Version string = "dev"
|
|||||||
|
|
||||||
// Options contains the flag options
|
// Options contains the flag options
|
||||||
type Options struct {
|
type Options struct {
|
||||||
Verbose []bool `short:"v" long:"verbose" description:"Show verbose logging."`
|
Verbose []bool `short:"v" long:"verbose" description:"Show verbose logging."`
|
||||||
Version bool `long:"version" description:"Print version and exit."`
|
Version bool `long:"version" description:"Print version and exit."`
|
||||||
Identity string `short:"i" long:"identity" description:"Private key to identify server with." default:"~/.ssh/id_rsa"`
|
Identity string `short:"i" long:"identity" description:"Private key to identify server with." default:"~/.ssh/id_rsa"`
|
||||||
Bind string `long:"bind" description:"Host and port to listen on." default:"0.0.0.0:2022"`
|
Bind string `long:"bind" description:"Host and port to listen on." default:"0.0.0.0:2022"`
|
||||||
Admin string `long:"admin" description:"File of public keys who are admins."`
|
Admin string `long:"admin" description:"File of public keys who are admins."`
|
||||||
Whitelist string `long:"whitelist" description:"Optional file of public keys who are allowed to connect."`
|
Whitelist string `long:"whitelist" description:"Optional file of public keys who are allowed to connect."`
|
||||||
Passphrase string `long:"unsafe-passphrase" description:"Require an interactive passphrase to connect. Whitelist feature is more secure."`
|
Motd string `long:"motd" description:"Optional Message of the Day file."`
|
||||||
Motd string `long:"motd" description:"Optional Message of the Day file."`
|
Log string `long:"log" description:"Write chat log to this file."`
|
||||||
Log string `long:"log" description:"Write chat log to this file."`
|
Pprof int `long:"pprof" description:"Enable pprof http server for profiling."`
|
||||||
Pprof int `long:"pprof" description:"Enable pprof http server for profiling."`
|
|
||||||
|
// Hidden flags, because they're discouraged from being used casually.
|
||||||
|
Passphrase string `long:"unsafe-passphrase" description:"Require an interactive passphrase to connect. Whitelist feature is more secure." hidden:"true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const extraHelp = `There are hidden options and easter eggs in ssh-chat. The source code is a good
|
||||||
|
place to start looking. Some useful links:
|
||||||
|
|
||||||
|
* Project Repository:
|
||||||
|
https://github.com/shazow/ssh-chat
|
||||||
|
* Project Wiki FAQ:
|
||||||
|
https://github.com/shazow/ssh-chat/wiki/FAQ
|
||||||
|
* Command Flags Declaration:
|
||||||
|
https://github.com/shazow/ssh-chat/blob/master/cmd/ssh-chat/cmd.go#L29
|
||||||
|
`
|
||||||
|
|
||||||
var logLevels = []log.Level{
|
var logLevels = []log.Level{
|
||||||
log.Warning,
|
log.Warning,
|
||||||
log.Info,
|
log.Info,
|
||||||
@ -61,6 +74,9 @@ func main() {
|
|||||||
if p == nil {
|
if p == nil {
|
||||||
fmt.Print(err)
|
fmt.Print(err)
|
||||||
}
|
}
|
||||||
|
if flagErr, ok := err.(*flags.Error); ok && flagErr.Type == flags.ErrHelp {
|
||||||
|
fmt.Print(extraHelp)
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user