mirror of
https://github.com/go-task/task.git
synced 2025-12-01 22:52:02 +02:00
refactor: executor functional options (#2085)
* refactor: executor functional options * refactor: minor tidy up of list code * fix: WithVersionCheck missing from call to NewExecutor * feat: docstrings for structs with functional options * refactor: prefix the functional options with the name of the struct they belong to
This commit is contained in:
14
help.go
14
help.go
@@ -41,20 +41,6 @@ func (o ListOptions) ShouldListTasks() bool {
|
||||
return o.ListOnlyTasksWithDescriptions || o.ListAllTasks
|
||||
}
|
||||
|
||||
// Validate validates that the collection of list-related options are in a valid configuration
|
||||
func (o ListOptions) Validate() error {
|
||||
if o.ListOnlyTasksWithDescriptions && o.ListAllTasks {
|
||||
return fmt.Errorf("task: cannot use --list and --list-all at the same time")
|
||||
}
|
||||
if o.FormatTaskListAsJSON && !o.ShouldListTasks() {
|
||||
return fmt.Errorf("task: --json only applies to --list or --list-all")
|
||||
}
|
||||
if o.NoStatus && !o.FormatTaskListAsJSON {
|
||||
return fmt.Errorf("task: --no-status only applies to --json with --list or --list-all")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Filters returns the slice of FilterFunc which filters a list
|
||||
// of ast.Task according to the given ListOptions
|
||||
func (o ListOptions) Filters() []FilterFunc {
|
||||
|
||||
Reference in New Issue
Block a user