From 502be29e28e708897b2e3ef00fec95a5a13426bd Mon Sep 17 00:00:00 2001 From: Marcos Lilljedahl Date: Sat, 13 Jun 2020 14:21:30 -0300 Subject: [PATCH] Add pruge prompt --- cmd/prune.go | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/cmd/prune.go b/cmd/prune.go index f524a01..5fdb3a0 100644 --- a/cmd/prune.go +++ b/cmd/prune.go @@ -1,6 +1,7 @@ package cmd import ( + "fmt" "os" "github.com/apex/log" @@ -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) }, }