aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/chzyer/readline/utils.go
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2022-09-09 15:08:46 +0200
committerGitHub <noreply@github.com>2022-09-09 15:08:46 +0200
commit04270a080d4a06e671da9d2d7e6e15f6108338d9 (patch)
tree49116c6281fc4ab6cfac6bb5c9fb9600cdcd4573 /vendor/github.com/chzyer/readline/utils.go
parent8a2ab7c387928782d8a1893c99974638054a0ad0 (diff)
parent8e1aa7af3a3d4fac1aefa94ed4a4455ac190ead9 (diff)
downloadpodman-04270a080d4a06e671da9d2d7e6e15f6108338d9.tar.gz
podman-04270a080d4a06e671da9d2d7e6e15f6108338d9.tar.bz2
podman-04270a080d4a06e671da9d2d7e6e15f6108338d9.zip
Merge pull request #15695 from Luap99/update-buildah
Update buildah and c/common to latest
Diffstat (limited to 'vendor/github.com/chzyer/readline/utils.go')
-rw-r--r--vendor/github.com/chzyer/readline/utils.go34
1 files changed, 34 insertions, 0 deletions
diff --git a/vendor/github.com/chzyer/readline/utils.go b/vendor/github.com/chzyer/readline/utils.go
index af4e00521..0706dd4ec 100644
--- a/vendor/github.com/chzyer/readline/utils.go
+++ b/vendor/github.com/chzyer/readline/utils.go
@@ -6,9 +6,11 @@ import (
"container/list"
"fmt"
"os"
+ "os/signal"
"strconv"
"strings"
"sync"
+ "syscall"
"time"
"unicode"
)
@@ -41,6 +43,7 @@ const (
CharCtrlY = 25
CharCtrlZ = 26
CharEsc = 27
+ CharO = 79
CharEscapeEx = 91
CharBackspace = 127
)
@@ -121,6 +124,27 @@ func escapeExKey(key *escapeKeyPair) rune {
return r
}
+// translate EscOX SS3 codes for up/down/etc.
+func escapeSS3Key(key *escapeKeyPair) rune {
+ var r rune
+ switch key.typ {
+ case 'D':
+ r = CharBackward
+ case 'C':
+ r = CharForward
+ case 'A':
+ r = CharPrev
+ case 'B':
+ r = CharNext
+ case 'H':
+ r = CharLineStart
+ case 'F':
+ r = CharLineEnd
+ default:
+ }
+ return r
+}
+
type escapeKeyPair struct {
attr string
typ rune
@@ -275,3 +299,13 @@ func Debug(o ...interface{}) {
fmt.Fprintln(f, o...)
f.Close()
}
+
+func CaptureExitSignal(f func()) {
+ cSignal := make(chan os.Signal, 1)
+ signal.Notify(cSignal, os.Interrupt, syscall.SIGTERM)
+ go func() {
+ for range cSignal {
+ f()
+ }
+ }()
+}