package cmd import ( "sort" "git.wntrmute.dev/kyle/arca/internal/config" "github.com/spf13/cobra" ) // completeDeviceOrAlias provides dynamic completion for device aliases // and device paths from the config file. func completeDeviceOrAlias(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { if len(args) > 0 { return nil, cobra.ShellCompDirectiveNoFileComp } cfg := config.Load() var completions []string for alias := range cfg.Devices { completions = append(completions, alias) } sort.Strings(completions) return completions, cobra.ShellCompDirectiveNoFileComp }