Codebase list golang-github-vbauerster-mpb / 7ac7c77
OnCompleteMetaOrOnAbortMeta Vladimir Bauer 2 years ago
1 changed file(s) with 11 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
77 func OnCompleteOrOnAbort(decorator Decorator, message string) Decorator {
88 return OnComplete(OnAbort(decorator, message), message)
99 }
10
11 // OnCompleteMetaOrOnAbortMeta wrap decorator.
12 // Provided fn is supposed to wrap output of given decorator
13 // with meta information like ANSI escape codes for example.
14 // Primary usage intention is to set SGR display attributes.
15 //
16 // `decorator` Decorator to wrap
17 // `fn` func to apply meta information
18 func OnCompleteMetaOrOnAbortMeta(decorator Decorator, fn func(string) string) Decorator {
19 return OnCompleteMeta(OnAbortMeta(decorator, fn), fn)
20 }