It would be logical to check that the directory/path argument is supplied and that the directory exists.
$ devcontainer.vim templates apply
✔ Ubuntu
/home/ant/.cache/devcontainer.vim/bin/devcontainer aleady exist, use this.
panic: runtime error: index out of range [-1]
goroutine 1 [running]:
main.main.func3(0x367eadb25100)
/home/runner/work/devcontainer.vim/devcontainer.vim/main.go:362 +0xa3f
github.com/urfave/cli/v2.(*Command).Run(0x367eadbf8420, 0x367eadb25100, {0x367eadb18e90, 0x1, 0x1})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/command.go:276 +0x7c2
github.com/urfave/cli/v2.(*Command).Run(0x367eadbf82c0, 0x367eadb25040, {0x367eadb85260, 0x2, 0x2})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/command.go:269 +0xa30
github.com/urfave/cli/v2.(*Command).Run(0x367ead4fc9a0, 0x367eadb24d40, {0x367ead02c150, 0x3, 0x3})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/command.go:269 +0xa30
github.com/urfave/cli/v2.(*App).RunContext(0x367ead4ba000, {0x9eb610, 0xe80100}, {0x367ead02c150, 0x3, 0x3})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/app.go:333 +0x5a5
github.com/urfave/cli/v2.(*App).Run(...)
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/app.go:307
main.main()
/home/runner/work/devcontainer.vim/devcontainer.vim/main.go:1013 +0x28b3
It would be logical to check that the directory/path argument is supplied and that the directory exists.
$ devcontainer.vim templates apply
✔ Ubuntu
/home/ant/.cache/devcontainer.vim/bin/devcontainer aleady exist, use this.
panic: runtime error: index out of range [-1]
goroutine 1 [running]:
main.main.func3(0x367eadb25100)
/home/runner/work/devcontainer.vim/devcontainer.vim/main.go:362 +0xa3f
github.com/urfave/cli/v2.(*Command).Run(0x367eadbf8420, 0x367eadb25100, {0x367eadb18e90, 0x1, 0x1})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/command.go:276 +0x7c2
github.com/urfave/cli/v2.(*Command).Run(0x367eadbf82c0, 0x367eadb25040, {0x367eadb85260, 0x2, 0x2})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/command.go:269 +0xa30
github.com/urfave/cli/v2.(*Command).Run(0x367ead4fc9a0, 0x367eadb24d40, {0x367ead02c150, 0x3, 0x3})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/command.go:269 +0xa30
github.com/urfave/cli/v2.(*App).RunContext(0x367ead4ba000, {0x9eb610, 0xe80100}, {0x367ead02c150, 0x3, 0x3})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/app.go:333 +0x5a5
github.com/urfave/cli/v2.(*App).Run(...)
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/app.go:307
main.main()
/home/runner/work/devcontainer.vim/devcontainer.vim/main.go:1013 +0x28b3