(env *execenv.Env)
| 78 | } |
| 79 | |
| 80 | func GitRemote(env *execenv.Env) ValidArgsFunction { |
| 81 | return func(cmd *cobra.Command, args []string, toComplete string) (completions []string, directives cobra.ShellCompDirective) { |
| 82 | if err := execenv.LoadBackend(env)(cmd, args); err != nil { |
| 83 | return HandleError(err) |
| 84 | } |
| 85 | defer func() { |
| 86 | _ = env.Backend.Close() |
| 87 | }() |
| 88 | |
| 89 | remoteMap, err := env.Backend.GetRemotes() |
| 90 | if err != nil { |
| 91 | return HandleError(err) |
| 92 | } |
| 93 | completions = make([]string, 0, len(remoteMap)) |
| 94 | for remote, url := range remoteMap { |
| 95 | completions = append(completions, remote+"\t"+"Remote: "+url) |
| 96 | } |
| 97 | sort.Strings(completions) |
| 98 | return completions, cobra.ShellCompDirectiveNoFileComp |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | func Label(env *execenv.Env) ValidArgsFunction { |
| 103 | return func(cmd *cobra.Command, args []string, toComplete string) (completions []string, directives cobra.ShellCompDirective) { |
no test coverage detected