kcmerrill / alfred

(v0.2) Even Batman needs a little help. Task runner. Automator. Build system.
MIT License
63 stars 14 forks source link

Registered Variable Example Throwing Error #34

Closed bobhenkel closed 7 years ago

bobhenkel commented 7 years ago

Alfred is awesome, thanks so much!

I'm following along with the example in manual that shows you how to register a reusable value. When I call alfred forty.two with the below setup I'm getting the error below.

fourty.one:
    summary: Register a variable
    register: my.new.var
    command: |
        echo "5678"

fourty.two:
    setup: fourty.one
    summary: Retrieve a registered variable
    command: |
        echo The variable is {{ index .Vars "my.new.var"}}
[fourty.one] Register a variable (Args: [])
panic: assignment to entry in nil map

goroutine 1 [running]:
panic(0x733c80, 0xc4200fc6d0)
    /usr/local/go/src/runtime/panic.go:500 +0x1a1
github.com/kcmerrill/alfred/alfred.(*Alfred).runTask(0xc4200e1110, 0xc4200fc2d0, 0xa, 0xc420078060, 0x0, 0x0, 0xc420071800, 0x1)
    /go/src/github.com/kcmerrill/alfred/alfred/alfred.go:215 +0x186f
github.com/kcmerrill/alfred/alfred.(*Alfred).runTask(0xc4200e1110, 0x7ffcf7f10e87, 0xa, 0xc420078060, 0x0, 0x0, 0x0, 0x0)
    /go/src/github.com/kcmerrill/alfred/alfred/alfred.go:143 +0x2b3
github.com/kcmerrill/alfred/alfred.(*Alfred).findTask(0xc4200e1110, 0x68d)
    /go/src/github.com/kcmerrill/alfred/alfred/alfred.go:106 +0x46d
github.com/kcmerrill/alfred/alfred.New(0xc420078060, 0x2, 0x2)
    /go/src/github.com/kcmerrill/alfred/alfred/alfred.go:68 +0x2ba
main.main()
    /go/src/github.com/kcmerrill/alfred/alfred.go:40 +0x1cf
kcmerrill commented 7 years ago

Hey thanks using it and for the star! I appreciate it!

Sorry for the bug! I will for sure take a peek when I get the chance.

bobhenkel commented 7 years ago

Thanks!

In case it matters: go version go1.7.5 linux/amd64

kcmerrill commented 7 years ago

I'm a little conflicted with this one. I know how to fix it, I just .... it's complicated.

Alfred is due for a rewrite so I might have to punt this until it's underway. One thing I can recommend until it's done is to run a command that just exports an env var for now, and retrieve it later.

kcmerrill commented 7 years ago

@ivelichkovich was able to fix this, and it looks like it's working now.

Woot woot!