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

Function parseRepoID

pkg/cmd/skills/update/update.go:699–719  ·  view source on GitHub ↗

parseRepoID parses the github-repo-id metadata value. A missing value returns 0, as skills installed by earlier versions don't record it.

(v any)

Source from the content-addressed store, hash-verified

697// parseRepoID parses the github-repo-id metadata value. A missing value
698// returns 0, as skills installed by earlier versions don't record it.
699func parseRepoID(v any) (int64, error) {
700 var id int64
701 switch v := v.(type) {
702 case nil:
703 return 0, nil
704 case int:
705 id = int64(v)
706 case string:
707 parsed, err := strconv.ParseInt(v, 10, 64)
708 if err != nil {
709 return 0, fmt.Errorf("invalid github-repo-id %q", v)
710 }
711 id = parsed
712 default:
713 return 0, fmt.Errorf("invalid github-repo-id %v", v)
714 }
715 if id <= 0 {
716 return 0, fmt.Errorf("invalid github-repo-id %d", id)
717 }
718 return id, nil
719}
720
721// promptForSkillOrigin asks the user for the source repository of a skill
722// that has no GitHub metadata.

Callers 1

parseInstalledSkillFunction · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected