Skip to content

zsh sqlcmd completion is broken #750

@Funghorn

Description

@Funghorn

Installed sqlcmd on MacOS with HomeBrew. After rebuilding ~/.zcompdump the command shows up fine:

% cat ~/.zcompdump | rg sqlcmd
'sqlcmd' '_sqlcmd'

However, trying to autocomplete commands like sqlcmd conf<TAB> or plain sqlcmd <TAB> does nothing.

Looks like there's a real problem there:

~ % sqlcmd __complete ''
panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/microsoft/go-sqlcmd/cmd/sqlcmd.isFlag(...)
        github.com/microsoft/go-sqlcmd/cmd/sqlcmd/sqlcmd.go:375
github.com/microsoft/go-sqlcmd/cmd/sqlcmd.checkDefaultValue({0x13c831621600, 0x2, 0x13c8317add88?}, 0x1)
        github.com/microsoft/go-sqlcmd/cmd/sqlcmd/sqlcmd.go:362 +0x2b8
github.com/microsoft/go-sqlcmd/cmd/sqlcmd.convertOsArgs({0x13c8312b6310?, 0x101b82380?, 0x100e1cb4b?})
        github.com/microsoft/go-sqlcmd/cmd/sqlcmd/sqlcmd.go:319 +0x1f0
github.com/microsoft/go-sqlcmd/cmd/sqlcmd.Execute({0x1010ea180, 0x6})
        github.com/microsoft/go-sqlcmd/cmd/sqlcmd/sqlcmd.go:289 +0x148
main.main()
        github.com/microsoft/go-sqlcmd/cmd/modern/main.go:52 +0x1b4

~ % sqlcmd __complete conf
:0
Completion ended with directive: ShellCompDirectiveDefault

Version: sqlcmd ✔: stable 1.10.0 (bottled)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions