From 80302b62f42693cc3336032e8b12fb92f8f76cf8 Mon Sep 17 00:00:00 2001 From: Djeeberjr Date: Tue, 23 Nov 2021 01:53:04 +0100 Subject: [PATCH] added Name func to ID --- internal/types/id.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/internal/types/id.go b/internal/types/id.go index ca1d006..246ee80 100644 --- a/internal/types/id.go +++ b/internal/types/id.go @@ -80,6 +80,11 @@ func (i ID) Parent() *ID { return parent } +// Name returns filename or directory name +func (i ID) Name() string { + return filepath.Base(i.Key) +} + // ParseID parses a string to an ID. Null if invalid func ParseID(id string) *ID { match := idRegex.FindStringSubmatch(id)