OnCompleteMetaOrOnAbortMeta
Vladimir Bauer
2 years ago
| 7 | 7 | func OnCompleteOrOnAbort(decorator Decorator, message string) Decorator { |
| 8 | 8 | return OnComplete(OnAbort(decorator, message), message) |
| 9 | 9 | } |
| 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 | } |