mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-25 17:52:02 +02:00
Drop another dependency
This commit is contained in:
@@ -10,13 +10,13 @@ import (
|
||||
"strings"
|
||||
"unicode"
|
||||
|
||||
"github.com/mattn/go-isatty"
|
||||
"github.com/mattn/go-runewidth"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
"golang.org/x/sys/unix"
|
||||
|
||||
"kitty"
|
||||
"kitty/tools/tty"
|
||||
"kitty/tools/utils"
|
||||
)
|
||||
|
||||
@@ -488,7 +488,7 @@ func Init(root *cobra.Command) {
|
||||
if kitty.VCSRevision != "" {
|
||||
vs = vs + " (" + kitty.VCSRevision + ")"
|
||||
}
|
||||
stdout_is_terminal = isatty.IsTerminal(os.Stdout.Fd())
|
||||
stdout_is_terminal = tty.IsTerminal(os.Stdout.Fd())
|
||||
RootCmd = root
|
||||
root.Version = vs
|
||||
root.SetUsageFunc(func(cmd *cobra.Command) error { return show_usage(cmd, false) })
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/mattn/go-isatty"
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/pflag"
|
||||
"golang.org/x/sys/unix"
|
||||
@@ -254,7 +253,7 @@ func get_password(password string, password_file string, password_env string, us
|
||||
}
|
||||
if ans == "" && password_file != "" {
|
||||
if password_file == "-" {
|
||||
if isatty.IsTerminal(os.Stdin.Fd()) {
|
||||
if tty.IsTerminal(os.Stdin.Fd()) {
|
||||
q, err := term.ReadPassword(int(os.Stdin.Fd()))
|
||||
if err != nil {
|
||||
ans = string(q)
|
||||
|
||||
@@ -19,6 +19,12 @@ const (
|
||||
TCSAFLUSH = 2
|
||||
)
|
||||
|
||||
func IsTerminal(fd uintptr) bool {
|
||||
var t unix.Termios
|
||||
err := Tcgetattr(int(fd), &t)
|
||||
return err == nil
|
||||
}
|
||||
|
||||
type Term struct {
|
||||
name string
|
||||
fd int
|
||||
|
||||
Reference in New Issue
Block a user