cmd/geth: improve msg

This commit is contained in:
Gary Rong 2023-12-21 21:56:36 +08:00
parent 81bbc4f1c0
commit f2ccd41c37

View file

@ -211,11 +211,11 @@ func removeDB(ctx *cli.Context) error {
} }
// Delete state data // Delete state data
statePaths := []string{rootDir, filepath.Join(ancientDir, rawdb.StateFreezerName)} statePaths := []string{rootDir, filepath.Join(ancientDir, rawdb.StateFreezerName)}
confirmAndRemoveDB(statePaths, "full node state database") confirmAndRemoveDB(statePaths, "state database")
// Delete ancient chain // Delete ancient chain
chainPaths := []string{filepath.Join(ancientDir, rawdb.ChainFreezerName)} chainPaths := []string{filepath.Join(ancientDir, rawdb.ChainFreezerName)}
confirmAndRemoveDB(chainPaths, "full node ancient chain") confirmAndRemoveDB(chainPaths, "ancient chain")
return nil return nil
} }
@ -238,9 +238,9 @@ func removeFolder(dir string) {
// confirmAndRemoveDB prompts the user for a last confirmation and removes the // confirmAndRemoveDB prompts the user for a last confirmation and removes the
// list of folders if accepted. // list of folders if accepted.
func confirmAndRemoveDB(paths []string, kind string) { func confirmAndRemoveDB(paths []string, kind string) {
msg := fmt.Sprintf("Remove %s?\n", kind) msg := fmt.Sprintf("Remove %s? ", kind)
for _, path := range paths { for _, path := range paths {
msg += fmt.Sprintf("\t- %s\n", path) msg += fmt.Sprintf("(%s) ", path)
} }
confirm, err := prompt.Stdin.PromptConfirm(msg) confirm, err := prompt.Stdin.PromptConfirm(msg)
switch { switch {