7// PatternInfo is an interface for types that represent glob patterns
8type PatternInfo interface {
11 isPattern() // marker method
14// StringPattern implements PatternInfo for string patterns
15type StringPattern struct {
19func (p StringPattern) GetPattern() string { return p.Pattern }
20func (p StringPattern) GetBasePath() string { return "" }
21func (p StringPattern) isPattern() {}
23// RelativePatternInfo implements PatternInfo for RelativePattern
24type RelativePatternInfo struct {
29func (p RelativePatternInfo) GetPattern() string { return string(p.RP.Pattern) }
30func (p RelativePatternInfo) GetBasePath() string { return p.BasePath }
31func (p RelativePatternInfo) isPattern() {}
33// AsPattern converts GlobPattern to a PatternInfo object
34func (g *GlobPattern) AsPattern() (PatternInfo, error) {
36 return nil, fmt.Errorf("nil pattern")
39 switch v := g.Value.(type) {
41 return StringPattern{Pattern: v}, nil
43 // Handle BaseURI which could be string or DocumentUri
45 switch baseURI := v.BaseURI.Value.(type) {
47 basePath = DocumentURI(baseURI).Path()
49 basePath = baseURI.Path()
51 return nil, fmt.Errorf("unknown BaseURI type: %T", v.BaseURI.Value)
53 return RelativePatternInfo{RP: v, BasePath: basePath}, nil
55 return nil, fmt.Errorf("unknown pattern type: %T", g.Value)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list