From 53b4d4702c7c1d1342d51b3f800ed140976597fc Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sun, 5 Jun 2016 22:02:09 -0700 Subject: [PATCH] Add directory query --- file.go | 4 ++++ goldsmith.go | 1 + 2 files changed, 5 insertions(+) diff --git a/file.go b/file.go index b1984ab..a69ce94 100644 --- a/file.go +++ b/file.go @@ -99,6 +99,10 @@ func (f *file) Path() string { return f.path } +func (f *file) Dir() string { + return path.Dir(f.path) +} + func (f *file) Value(key string) (interface{}, bool) { value, ok := f.Meta[key] return value, ok diff --git a/goldsmith.go b/goldsmith.go index 7d5d927..c4186f2 100644 --- a/goldsmith.go +++ b/goldsmith.go @@ -40,6 +40,7 @@ func Begin(srcDir string) Goldsmith { type File interface { Path() string + Dir() string Value(key string) (interface{}, bool) SetValue(key string, value interface{})