Documentation
¶
Overview ¶
Package source parses, normalizes, and classifies skill source references (git shorthand, full HTTPS/SSH, local path, url) into a canonical identity.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidSource = errors.New("invalid source")
ErrInvalidSource is returned when a source argument cannot be parsed.
Functions ¶
This section is empty.
Types ¶
type Ref ¶
type Ref struct {
Type Type
Original string
URL string
Owner string
Repo string
Path string
LocalPath string
}
Ref is a parsed, normalized source reference.
func Parse ¶
Parse classifies and normalizes a raw source argument.
Example ¶
package main
import (
"fmt"
"github.com/glapsfun/gskill/internal/source"
)
func main() {
ref, _ := source.Parse("github.com/acme/widgets/my-skill")
fmt.Println(ref.Type, ref.Owner, ref.Repo, ref.Path)
fmt.Println(ref.URL)
}
Output: git acme widgets my-skill https://github.com/acme/widgets.git
func (Ref) Display ¶ added in v0.3.0
Display returns a short human name for progress lines: owner/repo when known, else the repo name (local-promoted git repos have no owner), else the canonical identity (never the raw URL, which may carry credentials). For git identities the empty host/owner segments are trimmed so a bare-URL ref renders as its host, not "host//"; local paths pass through untouched.