mirror of
				https://github.com/go-task/task.git
				synced 2025-10-30 23:58:01 +02:00 
			
		
		
		
	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 <60318513+Trite8Q1@users.noreply.github.com>
This commit is contained in:
		| @@ -2,7 +2,12 @@ | ||||
|  | ||||
| ## Unreleased | ||||
|  | ||||
| - Add support for yaml extension ([#584](https://github.com/go-task/task/issues/584)) | ||||
| - Remove long deprecated and undocumented `$` variable prefix and `^` command | ||||
|   prefix | ||||
|   ([#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)). | ||||
| - Add support for `.yaml` extension (as an alternative to `.yml`). | ||||
|   This was requested multiple times throughout the years. Enjoy! | ||||
|   ([#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)). | ||||
|  | ||||
| ## v3.9.2 - 2021-12-02 | ||||
|  | ||||
|   | ||||
| @@ -1,9 +1,5 @@ | ||||
| package taskfile | ||||
|  | ||||
| import ( | ||||
| 	"strings" | ||||
| ) | ||||
|  | ||||
| // Cmd is a task command | ||||
| type Cmd struct { | ||||
| 	Cmd         string | ||||
| @@ -23,11 +19,7 @@ type Dep struct { | ||||
| func (c *Cmd) UnmarshalYAML(unmarshal func(interface{}) error) error { | ||||
| 	var cmd string | ||||
| 	if err := unmarshal(&cmd); err == nil { | ||||
| 		if strings.HasPrefix(cmd, "^") { | ||||
| 			c.Task = strings.TrimPrefix(cmd, "^") | ||||
| 		} else { | ||||
| 			c.Cmd = cmd | ||||
| 		} | ||||
| 		c.Cmd = cmd | ||||
| 		return nil | ||||
| 	} | ||||
| 	var cmdStruct struct { | ||||
|   | ||||
| @@ -2,7 +2,6 @@ package taskfile | ||||
|  | ||||
| import ( | ||||
| 	"errors" | ||||
| 	"strings" | ||||
|  | ||||
| 	"gopkg.in/yaml.v3" | ||||
| ) | ||||
| @@ -108,11 +107,7 @@ type Var struct { | ||||
| func (v *Var) UnmarshalYAML(unmarshal func(interface{}) error) error { | ||||
| 	var str string | ||||
| 	if err := unmarshal(&str); err == nil { | ||||
| 		if strings.HasPrefix(str, "$") { | ||||
| 			v.Sh = strings.TrimPrefix(str, "$") | ||||
| 		} else { | ||||
| 			v.Static = str | ||||
| 		} | ||||
| 		v.Static = str | ||||
| 		return nil | ||||
| 	} | ||||
|  | ||||
|   | ||||
							
								
								
									
										3
									
								
								testdata/vars/v2/Taskfile.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								testdata/vars/v2/Taskfile.yml
									
									
									
									
										vendored
									
									
								
							| @@ -35,7 +35,8 @@ tasks: | ||||
|       - echo '{{.TASK}}' > task_name.txt | ||||
|     vars: | ||||
|       FOO: foo | ||||
|       BAR: $echo bar | ||||
|       BAR: | ||||
|         sh: echo bar | ||||
|       BAZ: | ||||
|         sh: echo baz | ||||
|       TMPL_FOO: "{{.FOO}}" | ||||
|   | ||||
							
								
								
									
										3
									
								
								testdata/vars/v2/Taskvars.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								testdata/vars/v2/Taskvars.yml
									
									
									
									
										vendored
									
									
								
							| @@ -1,5 +1,6 @@ | ||||
| FOO2: foo2 | ||||
| BAR2: $echo bar2 | ||||
| BAR2: | ||||
|   sh: echo bar2 | ||||
| BAZ2: | ||||
|   sh: echo baz2 | ||||
| TMPL2_FOO: "{{.FOO}}" | ||||
|   | ||||
		Reference in New Issue
	
	Block a user