forked from TrueCloudLab/rclone
config: add ReadNonEmptyLine utility function
This commit is contained in:
parent
74f6300875
commit
262ba28dec
1 changed files with 10 additions and 0 deletions
|
@ -624,6 +624,16 @@ var ReadLine = func() string {
|
||||||
return strings.TrimSpace(line)
|
return strings.TrimSpace(line)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ReadNonEmptyLine prints prompt and calls Readline until non empty
|
||||||
|
func ReadNonEmptyLine(prompt string) string {
|
||||||
|
result := ""
|
||||||
|
for result == "" {
|
||||||
|
fmt.Print(prompt)
|
||||||
|
result = strings.TrimSpace(ReadLine())
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
// Command - choose one
|
// Command - choose one
|
||||||
func Command(commands []string) byte {
|
func Command(commands []string) byte {
|
||||||
opts := []string{}
|
opts := []string{}
|
||||||
|
|
Loading…
Add table
Reference in a new issue