Compare commits

...

2 Commits

Author SHA1 Message Date
Valentin Maerten
24a3ccdf42 chore: changelog for #2871 2026-06-07 16:39:02 +02:00
Christian Provenzano
b455286b63 fix: deterministic ordering of required var prompts (#2871) 2026-06-07 16:36:58 +02:00
2 changed files with 17 additions and 12 deletions

View File

@@ -2,6 +2,9 @@
## Unreleased ## Unreleased
- Fixed --interactive prompts for required vars sometimes appearing in a random
order. Prompts now follow the order the vars are declared in the Taskfile.
(#2871 by @caproven)
- Fixed Fish completions not being picked up correctly by installing them to - Fixed Fish completions not being picked up correctly by installing them to
Fish's `vendor_completions.d` directory instead of `completions` (#2850, #2859 Fish's `vendor_completions.d` directory instead of `completions` (#2850, #2859
by @Legimity). by @Legimity).
@@ -16,9 +19,9 @@
cleaning `..` and `.` components (#2681, #2788 by @mateenanjum). cleaning `..` and `.` components (#2681, #2788 by @mateenanjum).
- Added `joinEnv` function to join paths based on your oprating system: `;` for - Added `joinEnv` function to join paths based on your oprating system: `;` for
Windows and `:` elsewhere, and `joinUrl` to join URL paths. Also, added two Windows and `:` elsewhere, and `joinUrl` to join URL paths. Also, added two
new special variables: `FILE_PATH_SEPARATOR` which returns `\` on Windows new special variables: `FILE_PATH_SEPARATOR` which returns `\` on Windows and
and `/` elsewhere, and `PATH_LIST_SEPARATOR` which returns `;` on Windows and `/` elsewhere, and `PATH_LIST_SEPARATOR` which returns `;` on Windows and `:`
`:` elsewhere (#2406, #2408 by @solvingj). elsewhere (#2406, #2408 by @solvingj).
- Update the shell interpreter with a regression fix (#2812, #2832 by - Update the shell interpreter with a regression fix (#2812, #2832 by
@andreynering). @andreynering).
- Fix potential panic with the shell interpreter (#2810 by @trulede). - Fix potential panic with the shell interpreter (#2810 by @trulede).
@@ -34,13 +37,13 @@
- Fixed watch mode ignoring SIGHUP signal, causing the watcher to exit instead - Fixed watch mode ignoring SIGHUP signal, causing the watcher to exit instead
of restarting (#2764, #2642). of restarting (#2764, #2642).
- Fixed a long time bug where the task wouldn't re-run as it should when using - Fixed a long time bug where the task wouldn't re-run as it should when using
`method: timestamp` and the files listed on `generates:` were deleted. `method: timestamp` and the files listed on `generates:` were deleted. This
This makes `method: timestamp` behaves the same as `method: checksum` makes `method: timestamp` behaves the same as `method: checksum` (#1230, #2716
(#1230, #2716 by @drichardson). by @drichardson).
## v3.49.1 - 2026-03-08 ## v3.49.1 - 2026-03-08
* Reverted #2632 for now, which caused some regressions. That change will be - Reverted #2632 for now, which caused some regressions. That change will be
reworked (#2720, #2722, #2723). reworked (#2720, #2722, #2723).
## v3.49.0 - 2026-03-07 ## v3.49.0 - 2026-03-07

View File

@@ -3,6 +3,8 @@ package task
import ( import (
"slices" "slices"
"github.com/elliotchance/orderedmap/v3"
"github.com/go-task/task/v3/errors" "github.com/go-task/task/v3/errors"
"github.com/go-task/task/v3/internal/input" "github.com/go-task/task/v3/internal/input"
"github.com/go-task/task/v3/internal/term" "github.com/go-task/task/v3/internal/term"
@@ -32,7 +34,7 @@ func (e *Executor) promptDepsVars(calls []*Call) error {
// Collect all missing vars from the dependency tree // Collect all missing vars from the dependency tree
visited := make(map[string]bool) visited := make(map[string]bool)
varsMap := make(map[string]*ast.VarsWithValidation) varsMap := orderedmap.NewOrderedMap[string, *ast.VarsWithValidation]()
var collect func(call *Call) error var collect func(call *Call) error
collect = func(call *Call) error { collect = func(call *Call) error {
@@ -42,8 +44,8 @@ func (e *Executor) promptDepsVars(calls []*Call) error {
} }
for _, v := range getMissingRequiredVars(compiledTask) { for _, v := range getMissingRequiredVars(compiledTask) {
if _, exists := varsMap[v.Name]; !exists { if !varsMap.Has(v.Name) {
varsMap[v.Name] = v varsMap.Set(v.Name, v)
} }
} }
@@ -73,14 +75,14 @@ func (e *Executor) promptDepsVars(calls []*Call) error {
} }
} }
if len(varsMap) == 0 { if varsMap.Len() == 0 {
return nil return nil
} }
prompter := e.newPrompter() prompter := e.newPrompter()
e.promptedVars = ast.NewVars() e.promptedVars = ast.NewVars()
for _, v := range varsMap { for v := range varsMap.Values() {
value, err := prompter.Prompt(v.Name, getEnumValues(v.Enum)) value, err := prompter.Prompt(v.Name, getEnumValues(v.Enum))
if err != nil { if err != nil {
if errors.Is(err, input.ErrCancelled) { if errors.Is(err, input.ErrCancelled) {