Voluntary exit CLI command (#7046)

* initial implementation of command

* Add second confirmation step

* fix variable name

* added unit tests

* add comment about stdin

* code review fixes

* removed commented-out code

* added log assert

Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
This commit is contained in:
rkapka
2020-08-20 19:53:09 +02:00
committed by GitHub
parent e93d31c60e
commit 45e4ed25a3
12 changed files with 281 additions and 26 deletions

View File

@@ -154,6 +154,7 @@ func encrypt(cliCtx *cli.Context) error {
}
if fileutil.FileExists(fullPath) {
response, err := promptutil.ValidatePrompt(
os.Stdin,
fmt.Sprintf("file at path %s already exists, are you sure you want to overwrite it? [y/n]", fullPath),
func(s string) error {
input := strings.ToLower(s)