Use reflect-compatible struct tags in examples
This commit is contained in:
committed by
Alec Thomas
parent
79f896f0c0
commit
f00d33b57c
@@ -12,10 +12,10 @@ var _ = kong.Must(&grammar{})
|
||||
|
||||
// Server interface.
|
||||
type grammar struct {
|
||||
Help helpCmd `cmd help:"Show help."`
|
||||
Question helpCmd `cmd hidden name:"?" help:"Show help."`
|
||||
Help helpCmd `cmd:"" help:"Show help."`
|
||||
Question helpCmd `cmd:"" hidden:"" name:"?" help:"Show help."`
|
||||
|
||||
Status statusCmd `cmd help:"Show server status."`
|
||||
Status statusCmd `cmd:"" help:"Show server status."`
|
||||
}
|
||||
|
||||
type statusCmd struct {
|
||||
@@ -28,7 +28,7 @@ func (s *statusCmd) Run(ctx *kong.Context) error {
|
||||
}
|
||||
|
||||
type helpCmd struct {
|
||||
Command []string `arg optional help:"Show help on command."`
|
||||
Command []string `arg:"" optional:"" help:"Show help on command."`
|
||||
}
|
||||
|
||||
// Run shows help.
|
||||
|
||||
@@ -18,17 +18,12 @@ import (
|
||||
"github.com/alecthomas/kong"
|
||||
)
|
||||
|
||||
type context struct {
|
||||
kong *kong.Context
|
||||
rl *readline.Instance
|
||||
}
|
||||
|
||||
// Handle a single SSH interactive connection.
|
||||
func handle(log *log.Logger, s ssh.Session) error {
|
||||
log.Printf("New SSH")
|
||||
sshPty, _, isPty := s.Pty()
|
||||
if !isPty {
|
||||
return errors.New("No PTY requested")
|
||||
return errors.New("no PTY requested")
|
||||
}
|
||||
log.Printf("Using TERM=%s width=%d height=%d", sshPty.Term, sshPty.Window.Width, sshPty.Window.Height)
|
||||
cpty, tty, err := pty.Open()
|
||||
|
||||
Reference in New Issue
Block a user