MCPcopy Create free account
hub / github.com/git-bug/git-bug / GitRemote

Function GitRemote

commands/completion/helper_completion.go:80–100  ·  view source on GitHub ↗
(env *execenv.Env)

Source from the content-addressed store, hash-verified

78}
79
80func 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
102func Label(env *execenv.Env) ValidArgsFunction {
103 return func(cmd *cobra.Command, args []string, toComplete string) (completions []string, directives cobra.ShellCompDirective) {

Callers 2

newPushCommandFunction · 0.92
newPullCommandFunction · 0.92

Calls 4

LoadBackendFunction · 0.92
HandleErrorFunction · 0.85
CloseMethod · 0.65
GetRemotesMethod · 0.65

Tested by

no test coverage detected