aboutsummaryrefslogtreecommitdiff
path: root/internal/cli/query.go
diff options
context:
space:
mode:
authorStefan Majewsky <majewsky@gmx.net>2025-09-29 21:45:56 +0200
committerStefan Majewsky <majewsky@gmx.net>2025-09-29 21:45:56 +0200
commit24762f09de2aa8cada3f3c63afa313e06ebf47c8 (patch)
tree260b236dbdaa4b21ab55f2ce54003446630dcea5 /internal/cli/query.go
parent6f4c551a522b94e80ace5657d2b8cdfc267d8ae2 (diff)
downloadgofu-24762f09de2aa8cada3f3c63afa313e06ebf47c8.tar.gz
replace deprecated dependencies with their successors
Diffstat (limited to 'internal/cli/query.go')
-rw-r--r--internal/cli/query.go18
1 files changed, 9 insertions, 9 deletions
diff --git a/internal/cli/query.go b/internal/cli/query.go
index add170c..a2bd004 100644
--- a/internal/cli/query.go
+++ b/internal/cli/query.go
@@ -26,11 +26,11 @@ import (
"strconv"
"strings"
- terminal "golang.org/x/crypto/ssh/terminal"
+ "golang.org/x/term"
)
-//cannot use `var errInterrupted = errors.New("Interrupted!")` because golint
-//complains about the formatting of the error message
+// cannot use `var errInterrupted = errors.New("Interrupted!")` because golint
+// complains about the formatting of the error message
type errInterrupted struct{}
func (e errInterrupted) Error() string {
@@ -75,7 +75,7 @@ func (t terminalTUI) Confirm(question string) (bool, error) {
}
}
-//Choice is a thing that the user can choose during Query().
+// Choice is a thing that the user can choose during Query().
type Choice struct {
//If given, the choice can be selected by pressing the key that
//produces this character.
@@ -212,11 +212,11 @@ func (b *buffer) getNextInput() []byte {
return result
}
- oldState, err := terminal.MakeRaw(0)
+ oldState, err := term.MakeRaw(0)
if err != nil {
panic(err)
}
- defer terminal.Restore(0, oldState)
+ defer term.Restore(0, oldState)
//fill buffer some more
n, err := b.Input.Read(b.buf[b.fill:])
@@ -235,7 +235,7 @@ type pipeTUI struct {
i *Implementation
}
-//AnsiColorCodeRx is a regexp that matches ANSI escape sequences of the type SGR.
+// AnsiColorCodeRx is a regexp that matches ANSI escape sequences of the type SGR.
var AnsiColorCodeRx = regexp.MustCompile("\x1B" + `\[[0-9;]*m`)
func (t *pipeTUI) Print(w io.Writer, msg string) {
@@ -267,8 +267,8 @@ func (t *pipeTUI) Confirm(question string) (bool, error) {
return ok, nil
}
-//Query for the pipe TUI is limited to exact matches of the choice text, or
-//matching by choice shortcut.
+// Query for the pipe TUI is limited to exact matches of the choice text, or
+// matching by choice shortcut.
func (t *pipeTUI) Query(prompt string, choices ...Choice) (string, error) {
str, err := t.i.stdinBuf.ReadString('\n')
if err != nil {