mirror of
https://github.com/miniflux/v2.git
synced 2025-09-30 19:22:11 +00:00
refactor: avoid unnecessary usage of Printf
This commit is contained in:
parent
d70817e441
commit
84078c7c20
6 changed files with 8 additions and 7 deletions
|
@ -5,6 +5,7 @@ package cli // import "miniflux.app/v2/internal/cli"
|
|||
|
||||
import (
|
||||
"bufio"
|
||||
"errors"
|
||||
"fmt"
|
||||
"os"
|
||||
"strings"
|
||||
|
@ -16,7 +17,7 @@ func askCredentials() (string, string) {
|
|||
fd := int(os.Stdin.Fd())
|
||||
|
||||
if !term.IsTerminal(fd) {
|
||||
printErrorAndExit(fmt.Errorf("this is not an interactive terminal, exiting"))
|
||||
printErrorAndExit(errors.New("this is not an interactive terminal, exiting"))
|
||||
}
|
||||
|
||||
fmt.Print("Enter Username: ")
|
||||
|
@ -30,6 +31,6 @@ func askCredentials() (string, string) {
|
|||
defer term.Restore(fd, state)
|
||||
bytePassword, _ := term.ReadPassword(fd)
|
||||
|
||||
fmt.Printf("\n")
|
||||
fmt.Print("\n")
|
||||
return strings.TrimSpace(username), strings.TrimSpace(string(bytePassword))
|
||||
}
|
||||
|
|
|
@ -263,6 +263,6 @@ func Parse() {
|
|||
}
|
||||
|
||||
func printErrorAndExit(err error) {
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
fmt.Fprintln(os.Stderr, err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue