MCPcopy
hub / github.com/cli/cli / cloneRun

Function cloneRun

pkg/cmd/gist/clone/clone.go:75–94  ·  view source on GitHub ↗
(opts *CloneOptions)

Source from the content-addressed store, hash-verified

73}
74
75func cloneRun(opts *CloneOptions) error {
76 gistURL := opts.Gist
77
78 if !git.IsURL(gistURL) {
79 cfg, err := opts.Config()
80 if err != nil {
81 return err
82 }
83 hostname, _ := cfg.Authentication().DefaultHost()
84 protocol := cfg.GitProtocol(hostname).Value
85 gistURL = formatRemoteURL(hostname, gistURL, protocol)
86 }
87
88 _, err := opts.GitClient.Clone(context.Background(), gistURL, opts.GitArgs)
89 if err != nil {
90 return err
91 }
92
93 return nil
94}
95
96func formatRemoteURL(hostname string, gistID string, protocol string) string {
97 if ghauth.IsEnterprise(hostname) {

Callers 1

NewCmdCloneFunction · 0.70

Calls 7

IsURLFunction · 0.92
formatRemoteURLFunction · 0.85
ConfigMethod · 0.65
DefaultHostMethod · 0.65
AuthenticationMethod · 0.65
GitProtocolMethod · 0.65
CloneMethod · 0.65

Tested by

no test coverage detected