JanDeDobbeleer / aliae

Cross shell and platform alias management
https://aliae.dev
MIT License
73 stars 3 forks source link

init fails when ALIAE_CONFIG points to url #79

Closed harrhp closed 6 months ago

harrhp commented 6 months ago

Code of Conduct

What happened?

51 addded support for setting config via environment variable, but it works only for local files. When variable points to remote file initialization fails

my pwsh profile looks like this

$env:ALIAE_CONFIG = "https://...";
aliae init pwsh | Invoke-Expression

pwsh error

panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x18 pc=0x6d1b09]

goroutine 1 [running]:
github.com/jandedobbeleer/aliae/src/config.LoadConfig({0xc00011c0b2?, 0x4?})
        /home/runner/work/aliae/aliae/src/config/config.go:54 +0xe9
github.com/jandedobbeleer/aliae/src/core.Init({0xc00011c0b2, 0x0}, {0xc00011c090, 0x4}, 0x1)
        /home/runner/work/aliae/aliae/src/core/init.go:18 +0x9e
github.com/jandedobbeleer/aliae/src/cli.runInit({0xc00011c090?, 0x0?})
        /home/runner/work/aliae/aliae/src/cli/init.go:48 +0x39
github.com/jandedobbeleer/aliae/src/cli.glob..func2(0xc00016e100?, {0xc0001090b0?, 0x4?, 0x781f08?})
        /home/runner/work/aliae/aliae/src/cli/init.go:36 +0x2f
github.com/spf13/cobra.(*Command).execute(0xac6e60, {0xc000109050, 0x3, 0x3})
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:987 +0xaa3
github.com/spf13/cobra.(*Command).ExecuteC(0xac7140)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x3ff
github.com/spf13/cobra.(*Command).Execute(...)
        /home/runner/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039
github.com/jandedobbeleer/aliae/src/cli.Execute({0x830ca0?, 0xc000088000?})
        /home/runner/work/aliae/aliae/src/cli/root.go:36 +0x49
main.main()
        /home/runner/work/aliae/aliae/src/main.go:10 +0x25
Invoke-Expression: Cannot bind argument to parameter 'Command' because it is an empty string.

What OS are you seeing the problem on?

Windows

Which shell are you using?

powershell