Skip to content

Commit

Permalink
feat(views): print file path to the matching view when using --debug
Browse files Browse the repository at this point in the history
  • Loading branch information
reubenmiller committed May 18, 2024
1 parent 9d39f87 commit c5fa84b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion pkg/dataview/dataview.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var NamespaceSeparator = "::"
// Definition contains the view definition of when to use a specific view
type Definition struct {
FileName string `json:"-"`
Path string `json:"-"`
Extension string `json:"-"`
Name string `json:"name,omitempty"`
Priority int `json:"priority,omitempty"`
Expand Down Expand Up @@ -138,6 +139,7 @@ func (v *DataView) LoadDefinitions() error {
}
for i := range viewDefinition.Definitions {
viewDefinition.Definitions[i].FileName = d.Name()
viewDefinition.Definitions[i].Path = path
viewDefinition.Definitions[i].Extension = extName
}
definitions = append(definitions, viewDefinition.Definitions...)
Expand Down Expand Up @@ -311,7 +313,11 @@ func (v *DataView) GetView(r *ViewData) ([]string, error) {
}
}
if matchingDefinition != nil {
v.Logger.Debugf("Found matching view: name=%s", matchingDefinition.Name)
if matchingDefinition.Extension != "" {
v.Logger.Debugf("Found matching view: name=%s, extension=%s, file: %s", matchingDefinition.Name, matchingDefinition.Extension, matchingDefinition.Path)
} else {
v.Logger.Debugf("Found matching view: name=%s, file: %s", matchingDefinition.Name, matchingDefinition.Path)
}
v.ActiveView = matchingDefinition
return matchingDefinition.Columns, nil
}
Expand Down

0 comments on commit c5fa84b

Please sign in to comment.