Skip to content

Commit

Permalink
Add pruge prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosnils committed Jun 13, 2020
1 parent 3f5bc9b commit 502be29
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions cmd/prune.go
@@ -1,6 +1,7 @@
package cmd

import (
"fmt"
"os"

"github.com/apex/log"
Expand Down Expand Up @@ -35,6 +36,21 @@ func newPruneCmd() *pruneCmd {
}
}

//TODO will have to refactor this prompt to a separate function
//so it can be reused in some other places
fmt.Printf("\nThe following paths will be removed. Continue? [Y/n] ")
var response string

_, err := fmt.Scanln(&response)

if err != nil {
return fmt.Errorf("Invalid input")
}

if response != "Y" {
return fmt.Errorf("Update aborted")
}

return config.RemoveBinaries(pathsToDel)
},
}
Expand Down

0 comments on commit 502be29

Please sign in to comment.