diff --git a/decor/on_compete_or_on_abort.go b/decor/on_compete_or_on_abort.go index bba2920..f9ca841 100644 --- a/decor/on_compete_or_on_abort.go +++ b/decor/on_compete_or_on_abort.go @@ -8,3 +8,14 @@ func OnCompleteOrOnAbort(decorator Decorator, message string) Decorator { return OnComplete(OnAbort(decorator, message), message) } + +// OnCompleteMetaOrOnAbortMeta wrap decorator. +// Provided fn is supposed to wrap output of given decorator +// with meta information like ANSI escape codes for example. +// Primary usage intention is to set SGR display attributes. +// +// `decorator` Decorator to wrap +// `fn` func to apply meta information +func OnCompleteMetaOrOnAbortMeta(decorator Decorator, fn func(string) string) Decorator { + return OnCompleteMeta(OnAbortMeta(decorator, fn), fn) +}