dedupe command to deduplicate a remote. Useful with google drive - fixes #41

This commit is contained in:
Nick Craig-Wood
2016-01-31 12:58:41 +00:00
parent 1373efaa39
commit 0f73129ab7
4 changed files with 132 additions and 0 deletions

View File

@@ -413,6 +413,25 @@ func Choose(what string, defaults, help []string, newOk bool) string {
}
}
// ChooseNumber asks the user to enter a number between min and max
// inclusive prompting them with what.
func ChooseNumber(what string, min, max int) int {
for {
fmt.Printf("%s> ", what)
result := ReadLine()
i, err := strconv.Atoi(result)
if err != nil {
fmt.Printf("Bad number: %v\n", err)
continue
}
if i < min || i > max {
fmt.Printf("Out of range - %d to %d inclusive\n", min, max)
continue
}
return i
}
}
// ShowRemote shows the contents of the remote
func ShowRemote(name string) {
fmt.Printf("--------------------\n")