Skip to content

Commit

Permalink
Reworked register variable
Browse files Browse the repository at this point in the history
 - instead of dying, continues on
 - will revert if we find setup tasks being more useful, but it's causing contention with task groups. If this isn't sufficient, I'll need to figure out a different strategy.
  • Loading branch information
kcmerrill committed Mar 24, 2017
1 parent 18c17d7 commit 76f1c84
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 5 deletions.
2 changes: 0 additions & 2 deletions alfred/alfred.go
Original file line number Diff line number Diff line change
Expand Up @@ -212,8 +212,6 @@ func (a *Alfred) runTask(task string, args []string, formatted bool) bool {
// Register task output
if copyOfTask.Register != "" && copyOfTask.Command != "" {
a.Vars[copyOfTask.Register] = copyOfTask.Exec(copyOfTask.Command)
// No need to continue on ... return
return true
}

// Test ...
Expand Down
2 changes: 1 addition & 1 deletion alfred_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ func TestTaskMultiArguments(t *testing.T) {
}

func TestRegisteringVariables(t *testing.T) {
sut, _ := run("alfred fourty.two", t)
sut, _ := run("alfred fourty.one", t)

if !strings.Contains(sut, "The variable is 5678") {
t.Logf("Expecting 5678 to be returned")
Expand Down
4 changes: 2 additions & 2 deletions examples/demo-everything/.alfred/part-two.alfred.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ fourty.one:
register: my.new.var
command: |
echo "5678"
ok: fourty.two

fourty.two:
setup: fourty.one
summary: Retrieve a registered variable
command: |
echo The variable is {{ index .Vars "my.new.var"}}
Expand All @@ -24,4 +24,4 @@ fourty.three:

fourty.four:
summary: A task with two params
command: echo {{ index .Args 0 }} {{ index .Args 1 }}
command: echo {{ index .Args 0 }} {{ index .Args 1 }}

0 comments on commit 76f1c84

Please sign in to comment.