lockbox

password manager
Log | Files | Refs | README | LICENSE

commit b347bfeb4b514612368619edd7630034d6736d34
parent 2c9d49c266c5387ea1d1eef0b8270135b0ca341e
Author: Sean Enck <sean@ttypty.com>
Date:   Sat, 17 Aug 2024 07:53:41 -0400

use ascii codes for clear

Diffstat:
Minternal/app/totp.go | 12+++---------
1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/internal/app/totp.go b/internal/app/totp.go @@ -4,8 +4,6 @@ package app import ( "errors" "fmt" - "os" - "os/exec" "strings" "time" @@ -67,18 +65,14 @@ const ( func NewDefaultTOTPOptions(app CommandOptions) TOTPOptions { return TOTPOptions{ app: app, - Clear: clear, + Clear: clearFunc, IsInteractive: config.EnvInteractive.Get, IsNoTOTP: config.EnvNoTOTP.Get, } } -func clear() { - cmd := exec.Command("clear") - cmd.Stdout = os.Stdout - if err := cmd.Run(); err != nil { - fmt.Printf("unable to clear screen: %v\n", err) - } +func clearFunc() { + fmt.Print("\033[H\033[2J") } func colorWhenRules() ([]config.ColorWindow, error) {