-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove cnlubo/promptx and update dependencies
- Loading branch information
Showing
189 changed files
with
5,468 additions
and
11,947 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
package cli | ||
|
||
import ( | ||
"bufio" | ||
"fmt" | ||
"os" | ||
"strings" | ||
|
||
"github.com/fatih/color" | ||
) | ||
|
||
// Inspiration from: https://gist.github.com/r0l1/3dcbb0c8f6cfe9c66ab8008f55f8f28b | ||
func askForConfirmation(s string) (bool, error) { | ||
c := color.New(color.FgCyan) | ||
reader := bufio.NewReader(os.Stdin) | ||
|
||
for i := 0; i < 2; i++ { | ||
c.Printf("%s [y/N]: ", s) | ||
|
||
response, err := reader.ReadString('\n') | ||
if err != nil { | ||
return false, fmt.Errorf("Error reading input") | ||
} | ||
|
||
response = strings.ToLower(strings.TrimSpace(response)) | ||
|
||
if response == "y" || response == "yes" { | ||
return true, nil | ||
} else if response == "n" || response == "no" { | ||
return false, nil | ||
} | ||
} | ||
|
||
return false, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.