mirror of https://github.com/miguelmota/cointop
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
434 B
Go
22 lines
434 B
Go
package cointop
|
|
|
|
import (
|
|
"bufio"
|
|
"fmt"
|
|
"os"
|
|
"strings"
|
|
)
|
|
|
|
// ReadAPIKeyFromStdin reads the user inputed API from the stdin prompt
|
|
func (ct *Cointop) ReadAPIKeyFromStdin(name string) (string, error) {
|
|
ct.debuglog("ReadAPIKeyFromStdin()")
|
|
reader := bufio.NewReader(os.Stdin)
|
|
fmt.Printf("Enter %s API Key: ", name)
|
|
text, err := reader.ReadString('\n')
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
|
|
return strings.TrimSpace(text), nil
|
|
}
|