Skip to content

Commit

Permalink
Merge pull request #370 from reubenmiller/feat-print-view-source-file
Browse files Browse the repository at this point in the history
feat(views): print file path to the matching view when using --debug
  • Loading branch information
reubenmiller committed May 18, 2024
2 parents ca1a1e8 + c5fa84b commit 163a8a7
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 163a8a7

Please sign in to comment.