go.temporal.io/server/tools/tdbg/prompter.go
80 LOC · 34 covered · 46 uncovered · 13 ranges · 112 concepts · 12 introducers · 47 tests
File neighbourhood
The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.
Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file
In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.
Graph controls are ready.
Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.
package tdbg
import (
"bufio"
"fmt"
"io"
"os"
"strings"
)
type (
// Prompter is a helper for prompting the user for confirmation.
Prompter struct {
writer io.Writer
reader io.Reader
exiter func(code int)
flagLookup BoolFlagLookup
}
// PrompterParams is used to configure a new Prompter.
PrompterParams struct {
// Reader defaults to os.Stdin.
Reader io.Reader
// Writer defaults to os.Stdout.
Writer io.Writer
// Exiter defaults to [os.Exit].
Exiter func(code int)
}
// PrompterOption is used to override default PrompterParams.
PrompterOption func(*PrompterParams)
// BoolFlagLookup can be satisfied by [github.com/urfave/cli/v2.Context].
BoolFlagLookup interface {
Bool(name string) bool
}
PrompterFactory func(c BoolFlagLookup) *Prompter
)
return func(c BoolFlagLookup) *Prompter {
}
}
// NewPrompter creates a new Prompter. In most cases, the first argument should be [github.com/urfave/cli/v2.Context].
params := PrompterParams{
Writer: os.Stdout,
Reader: os.Stdin,
Exiter: os.Exit,
}
for _, opt := range opts {
}
writer: params.Writer,
reader: params.Reader,
exiter: params.Exiter,
flagLookup: c,
}
}
// Prompt the user for confirmation. If the user does not respond with "y" or "yes" (case-insensitive and without
// leading or trailing space), the process will exit with code 1.
if p.flagLookup.Bool(FlagYes) {
}
if err != nil {
}
text, err := reader.ReadString('\n')
if err != nil {
}
if textLower != "y" && textLower != "yes" {
}
}