1
0
mirror of https://github.com/go-task/task.git synced 2025-06-17 00:17:51 +02:00

feat(prompts): add ability for tasks to prompt user pre execution (#1163)

This commit is contained in:
Max Cheetham
2023-06-04 02:33:00 +01:00
committed by GitHub
parent 105756eb27
commit f815ce2901
11 changed files with 244 additions and 17 deletions

View File

@ -89,7 +89,7 @@ type TaskCalledTooManyTimesError struct {
func (err *TaskCalledTooManyTimesError) Error() string {
return fmt.Sprintf(
`task: maximum task call exceeded (%d) for task %q: probably an cyclic dep or infinite loop`,
`task: Maximum task call exceeded (%d) for task %q: probably an cyclic dep or infinite loop`,
err.MaximumTaskCall,
err.TaskName,
)
@ -98,3 +98,19 @@ func (err *TaskCalledTooManyTimesError) Error() string {
func (err *TaskCalledTooManyTimesError) Code() int {
return CodeTaskCalledTooManyTimes
}
// TaskCancelledError is returned when the user does not accept an optional prompt to continue.
type TaskCancelledError struct {
TaskName string
}
func (err *TaskCancelledError) Error() string {
return fmt.Sprintf(
`task: %q Cancelled by user`,
err.TaskName,
)
}
func (err *TaskCancelledError) Code() int {
return CodeTaskCancelled
}