-
Notifications
You must be signed in to change notification settings - Fork 83
Conversation
} | ||
} | ||
|
||
func (p *Path) Path() string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think there's going to be cases where we need a strings.Contains on these. What do you think about dangling functions off path like IsChild(s string)
so we can call those in templates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well the idea is we have the full Path()
:
/foo/bar/baz -> foo/bar/baz
Dir()
/foo/bar/baz -> /foo/bar
and File()
/foo/bar/baz -> baz
which I think pretty well covers what you'd want to match with eq. You can still do stringContains on any of em
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, I'm more talking about the DevX in the template. Instead of stringsContains
, we could write these functions to be able to be used like:
{{ .currentpath.IsDir("/foo") }}
versus
{{ stringsContains .currentpath.Dir "/foo" }}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh sure we can do that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
@whaught can you remove the other injection in the template middleware in another PR?
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: sethvargo, whaught The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Proposed Changes
Old
New
Release Note