MCPcopy Create free account
hub / github.com/cli/cli / guessGistName

Function guessGistName

pkg/cmd/gist/create/create.go:242–259  ·  view source on GitHub ↗
(files map[string]*shared.GistFile)

Source from the content-addressed store, hash-verified

240}
241
242func guessGistName(files map[string]*shared.GistFile) string {
243 filenames := make([]string, 0, len(files))
244 gistName := ""
245
246 re := regexp.MustCompile(`^gistfile\d+\.txt$`)
247 for k := range files {
248 if !re.MatchString(k) {
249 filenames = append(filenames, k)
250 }
251 }
252
253 if len(filenames) > 0 {
254 sort.Strings(filenames)
255 gistName = filenames[0]
256 }
257
258 return gistName
259}
260
261func createGist(client *http.Client, hostname, description string, public bool, files map[string]*shared.GistFile) (*shared.Gist, error) {
262 body := &shared.Gist{

Callers 3

Test_guessGistName_stdinFunction · 0.85
createRunFunction · 0.85

Calls

no outgoing calls

Tested by 2

Test_guessGistName_stdinFunction · 0.68