Skip to content

Commit

Permalink
Merge pull request #659 from rsteube/fix-action-stylef
Browse files Browse the repository at this point in the history
action: fix StyleF
  • Loading branch information
rsteube authored Jan 2, 2023
2 parents 1af8069 + 6829f10 commit cff823f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
6 changes: 1 addition & 5 deletions action.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,7 @@ func (a Action) StyleF(f func(s string, sc style.Context) string) Action {
return ActionCallback(func(c Context) Action {
invoked := a.Invoke(c)
for index, v := range invoked.rawValues {
path, err := c.Abs(v.Value)
if err != nil {
return ActionMessage(err.Error())
}
invoked.rawValues[index].Style = f(path, c)
invoked.rawValues[index].Style = f(v.Value, c)
}
return invoked.ToA()
})
Expand Down
3 changes: 3 additions & 0 deletions pkg/style/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ type Context interface {
//
// /tmp/locally/reachable/file.txt
func ForPath(path string, sc Context) string {
if abs, err := sc.Abs(path); err == nil {
path = abs
}
return fromSGR(lscolors.GetColorist(sc.Getenv("LS_COLORS")).GetStyle(path))
}

Expand Down

0 comments on commit cff823f

Please sign in to comment.