From 6c25e3b627dd80c080ec8f50c8fdf853af40506b Mon Sep 17 00:00:00 2001 From: Douglas Camata <159076+douglascamata@users.noreply.github.com> Date: Wed, 17 Aug 2022 19:06:17 +0200 Subject: [PATCH] Allow identification of type of PathOrContent (#16) * Allow identification of type of PathOrContent Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com> * Remove nil checks Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com> * Revert access to path and content Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com> * Fix Path() comment Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com> * Fix last check for path's presence Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com> Signed-off-by: Douglas Camata <159076+douglascamata@users.noreply.github.com> --- extkingpin/pathorcontent.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/extkingpin/pathorcontent.go b/extkingpin/pathorcontent.go index 055e412..0a4b5ff 100644 --- a/extkingpin/pathorcontent.go +++ b/extkingpin/pathorcontent.go @@ -96,6 +96,11 @@ func (p *PathOrContent) Content() ([]byte, error) { return content, nil } +// Path returns the file's path. +func (p *PathOrContent) Path() string { + return *p.path +} + // WithRequired allows you to override default required option. func WithRequired() Option { return func(p *PathOrContent) {