Skip to content

trellis ssh autocomplete error if specify args before #476

@mariusmateoc

Description

@mariusmateoc

Version

v1.12.1 and canary

What did you expect to happen?

To autocomplete the environment when I run the command trellis ssh -u web p[TAB] should autocomplete the production environment.

What actually happens?

Receive an: panic: runtime error: invalid memory address or nil pointer dereference

Steps to reproduce

Make sure that you have Shell Integration setup and is working.

• Run the command trellis ssh -u web p and then p hit the tab for autocomplete the environment.

System info

Chip: Apple M2 Max
macOS Ventura: 13.6.9 (22G830)
shell: bash

trellis check
Checking Trellis requirements...

Required:
[✓] Python [>= 3.8.0]: 3.11.4

Optional:
[✓] Vagrant [>= 2.1.0]: 2.4.1
[X] VirtualBox [>= 4.3.10]: not installed

Log output

trellis ssh -u web ppanic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x2 addr=0x0 pc=0x10246d3f0]

goroutine 1 [running]:
github.com/roots/trellis-cli/trellis.(*Trellis).SiteNamesFromEnvironment(0x14000039d40?, {0x14000022119?, 0x5?})
	/home/runner/work/trellis-cli/trellis-cli/trellis/trellis.go:244 +0x40
github.com/roots/trellis-cli/trellis.(*Trellis).PredictSite.func1({{0x14000344720, 0x3, 0x6}, {0x14000344720, 0x2, 0x6}, {0x0, 0x0}, {0x14000022119, 0x3}})
	/home/runner/work/trellis-cli/trellis-cli/trellis/complete.go:31 +0xc8
github.com/posener/complete.PredictFunc.Predict(0x140001495c8?, {{0x14000344720, 0x3, 0x6}, {0x14000344720, 0x2, 0x6}, {0x0, 0x0}, {0x14000022119, ...}})
	/home/runner/go/pkg/mod/github.com/posener/complete@v1.2.3/predict.go:33 +0x7c
github.com/posener/complete.(*Command).predict(0x1400034b0b0, {{0x14000344720, 0x3, 0x6}, {0x14000344720, 0x2, 0x6}, {0x0, 0x0}, {0x14000022119, ...}})
	/home/runner/go/pkg/mod/github.com/posener/complete@v1.2.3/command.go:107 +0x89c
github.com/posener/complete.(*Command).predict(0x1400035b180, {{0x14000344710, 0x4, 0x7}, {0x14000344710, 0x3, 0x7}, {0x0, 0x0}, {0x14000022119, ...}})
	/home/runner/go/pkg/mod/github.com/posener/complete@v1.2.3/command.go:73 +0xb88
github.com/posener/complete.(*Command).Predict(...)
	/home/runner/go/pkg/mod/github.com/posener/complete@v1.2.3/command.go:27
github.com/posener/complete.(*Complete).Complete(0x1400035b180)
	/home/runner/go/pkg/mod/github.com/posener/complete@v1.2.3/complete.go:69 +0x1f0
github.com/mitchellh/cli.(*CLI).Run(0x140002dc280)
	/home/runner/go/pkg/mod/github.com/mitchellh/cli@v1.1.5/cli.go:184 +0x88
main.main()
	/home/runner/work/trellis-cli/trellis-cli/main.go:222 +0x1d38

Please confirm this isn't a support request.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions