Merge pull request #10837 from filecoin-project/feat/ux-friendly-batch-cmd
feat: cli: More ux-friendly batching cmds
This commit is contained in:
commit
5697645748
@ -1922,10 +1922,31 @@ var sectorsBatchingPendingCommit = &cli.Command{
|
||||
for _, sector := range pending {
|
||||
fmt.Println(sector.Number)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
fmt.Println("No sectors queued to be committed")
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
fmt.Print("Do you want to publish these sectors now? (yes/no): ")
|
||||
userInput, err := reader.ReadString('\n')
|
||||
if err != nil {
|
||||
return xerrors.Errorf("reading user input: %w", err)
|
||||
}
|
||||
userInput = strings.ToLower(strings.TrimSpace(userInput))
|
||||
|
||||
if userInput == "yes" {
|
||||
err := cctx.Set("publish-now", "true")
|
||||
if err != nil {
|
||||
return xerrors.Errorf("setting publish-now flag: %w", err)
|
||||
}
|
||||
return cctx.Command.Action(cctx)
|
||||
} else if userInput == "no" {
|
||||
return nil
|
||||
} else {
|
||||
fmt.Println("Invalid input. Please answer with 'yes' or 'no'.")
|
||||
return nil
|
||||
}
|
||||
|
||||
} else {
|
||||
fmt.Println("No sectors queued to be committed")
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
@ -1980,10 +2001,31 @@ var sectorsBatchingPendingPreCommit = &cli.Command{
|
||||
for _, sector := range pending {
|
||||
fmt.Println(sector.Number)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
fmt.Println("No sectors queued to be committed")
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
fmt.Print("Do you want to publish these sectors now? (yes/no): ")
|
||||
userInput, err := reader.ReadString('\n')
|
||||
if err != nil {
|
||||
return xerrors.Errorf("reading user input: %w", err)
|
||||
}
|
||||
userInput = strings.ToLower(strings.TrimSpace(userInput))
|
||||
|
||||
if userInput == "yes" {
|
||||
err := cctx.Set("publish-now", "true")
|
||||
if err != nil {
|
||||
return xerrors.Errorf("setting publish-now flag: %w", err)
|
||||
}
|
||||
return cctx.Command.Action(cctx)
|
||||
} else if userInput == "no" {
|
||||
return nil
|
||||
} else {
|
||||
fmt.Println("Invalid input. Please answer with 'yes' or 'no'.")
|
||||
return nil
|
||||
}
|
||||
|
||||
} else {
|
||||
fmt.Println("No sectors queued to be committed")
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user