Skip to content

Commit 1c782c5

Browse files
Remove deprecated "$" and "^" prefixes
`$` was a variable prefix that make it being evaluated as shell. It was replaced with `sh:`. `^` is a command prefix that make it run another task. It was replaced with `task:`. These were added long ago when we were experimenting with stuff and kept for some time for backward compatibility reasons, but sometimes causes confusion and I think the time to remove the code came. Closes #644 Closes #645 Ref #642 Co-authored-by: Trite <[email protected]>
1 parent ed37071 commit 1c782c5

File tree

5 files changed

+12
-18
lines changed

5 files changed

+12
-18
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22

33
## Unreleased
44

5-
- Add support for yaml extension ([#584](https://github.com/go-task/task/issues/584))
5+
- Remove long deprecated and undocumented `$` variable prefix and `^` command
6+
prefix
7+
([#642](https://github.com/go-task/task/issues/642), [#644](https://github.com/go-task/task/issues/644), [#645](https://github.com/go-task/task/pull/645)).
8+
- Add support for `.yaml` extension (as an alternative to `.yml`).
9+
This was requested multiple times throughout the years. Enjoy!
10+
([#183](https://github.com/go-task/task/issues/183), [#184](https://github.com/go-task/task/pull/184), [#369](https://github.com/go-task/task/issues/369), [#584](https://github.com/go-task/task/issues/584), [#621](https://github.com/go-task/task/pull/621)).
611

712
## v3.9.2 - 2021-12-02
813

taskfile/cmd.go

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package taskfile
22

3-
import (
4-
"strings"
5-
)
6-
73
// Cmd is a task command
84
type Cmd struct {
95
Cmd string
@@ -23,11 +19,7 @@ type Dep struct {
2319
func (c *Cmd) UnmarshalYAML(unmarshal func(interface{}) error) error {
2420
var cmd string
2521
if err := unmarshal(&cmd); err == nil {
26-
if strings.HasPrefix(cmd, "^") {
27-
c.Task = strings.TrimPrefix(cmd, "^")
28-
} else {
29-
c.Cmd = cmd
30-
}
22+
c.Cmd = cmd
3123
return nil
3224
}
3325
var cmdStruct struct {

taskfile/var.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package taskfile
22

33
import (
44
"errors"
5-
"strings"
65

76
"gopkg.in/yaml.v3"
87
)
@@ -108,11 +107,7 @@ type Var struct {
108107
func (v *Var) UnmarshalYAML(unmarshal func(interface{}) error) error {
109108
var str string
110109
if err := unmarshal(&str); err == nil {
111-
if strings.HasPrefix(str, "$") {
112-
v.Sh = strings.TrimPrefix(str, "$")
113-
} else {
114-
v.Static = str
115-
}
110+
v.Static = str
116111
return nil
117112
}
118113

testdata/vars/v2/Taskfile.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ tasks:
3535
- echo '{{.TASK}}' > task_name.txt
3636
vars:
3737
FOO: foo
38-
BAR: $echo bar
38+
BAR:
39+
sh: echo bar
3940
BAZ:
4041
sh: echo baz
4142
TMPL_FOO: "{{.FOO}}"

testdata/vars/v2/Taskvars.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
FOO2: foo2
2-
BAR2: $echo bar2
2+
BAR2:
3+
sh: echo bar2
34
BAZ2:
45
sh: echo baz2
56
TMPL2_FOO: "{{.FOO}}"

0 commit comments

Comments
 (0)