cmd/tailscale/cli: add --record flag to bugreport (#5826)
Change-Id: I02bdc37a5c1a5a5d030c136ec5e84eb4c9ab1752 Signed-off-by: Andrew Dunham <andrew@tailscale.com>pull/5829/head
parent
e5636997c5
commit
5c69961a57
|
@ -8,6 +8,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"flag"
|
"flag"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/peterbourgon/ff/v3/ffcli"
|
"github.com/peterbourgon/ff/v3/ffcli"
|
||||||
"tailscale.com/client/tailscale"
|
"tailscale.com/client/tailscale"
|
||||||
|
@ -21,12 +22,14 @@ var bugReportCmd = &ffcli.Command{
|
||||||
FlagSet: (func() *flag.FlagSet {
|
FlagSet: (func() *flag.FlagSet {
|
||||||
fs := newFlagSet("bugreport")
|
fs := newFlagSet("bugreport")
|
||||||
fs.BoolVar(&bugReportArgs.diagnose, "diagnose", false, "run additional in-depth checks")
|
fs.BoolVar(&bugReportArgs.diagnose, "diagnose", false, "run additional in-depth checks")
|
||||||
|
fs.BoolVar(&bugReportArgs.record, "record", false, "if true, pause and then write another bugreport")
|
||||||
return fs
|
return fs
|
||||||
})(),
|
})(),
|
||||||
}
|
}
|
||||||
|
|
||||||
var bugReportArgs struct {
|
var bugReportArgs struct {
|
||||||
diagnose bool
|
diagnose bool
|
||||||
|
record bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func runBugReport(ctx context.Context, args []string) error {
|
func runBugReport(ctx context.Context, args []string) error {
|
||||||
|
@ -45,6 +48,22 @@ func runBugReport(ctx context.Context, args []string) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if bugReportArgs.record {
|
||||||
|
outln("The initial bugreport is below; please reproduce your issue and then press Enter...")
|
||||||
|
}
|
||||||
|
|
||||||
outln(logMarker)
|
outln(logMarker)
|
||||||
|
|
||||||
|
if bugReportArgs.record {
|
||||||
|
fmt.Scanln()
|
||||||
|
|
||||||
|
logMarker, err := localClient.BugReportWithOpts(ctx, tailscale.BugReportOpts{})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
outln(logMarker)
|
||||||
|
outln("Please provide both bugreport markers above to the support team or GitHub issue.")
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue