trim spaces from stdin.

This commit is contained in:
fiatjaf 2023-10-23 08:04:28 -03:00
parent 50dde2117c
commit c6e9fdd053
No known key found for this signature in database
GPG Key ID: BAD43C4BE5C1A3A1

View File

@ -6,6 +6,7 @@ import (
"io" "io"
"net/url" "net/url"
"os" "os"
"strings"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@ -16,7 +17,7 @@ func getStdin() string {
read := bytes.NewBuffer(make([]byte, 0, 1000)) read := bytes.NewBuffer(make([]byte, 0, 1000))
_, err := io.Copy(read, os.Stdin) _, err := io.Copy(read, os.Stdin)
if err == nil { if err == nil {
return read.String() return strings.TrimSpace(read.String())
} }
} }
return "" return ""