其他分享
首页 > 其他分享> > 「IRC」- 发送多行消息 @20210226

「IRC」- 发送多行消息 @20210226

作者:互联网

问题描述

我们希望在 IRC 客户端中,可以发送多行消息(即单条消息有多行内容),因为我们使用“多行的单条消息”来描述某个问题。

但是,在经过查找之后,我们发现 IRC 并不支持多行消息:
java - Linebreak IRC protocol - Stack Overflow
Insert line breaks into an IRC message - Stack Overflow

但是办法总是有的,我们的目的是将消息区分开,所以我们可以给消息添加边框。

解决方案

使用 Boxes 命令,或者其他命令,为消息添加边框:

# boxes -d stone << MSG
> Last build (#11), 6 mo 2 days ago
> Last stable build (#11), 6 mo 2 days ago
> Last successful build (#11), 6 mo 2 days ago
> Last failed build (#6), 6 mo 3 days ago
> Last unsuccessful build (#7), 6 mo 3 days ago
> Last completed build (#11), 6 mo 2 days ago
> MSG
+-----------------------------------------------+
| Last build (#11), 6 mo 2 days ago             |
| Last stable build (#11), 6 mo 2 days ago      |
| Last successful build (#11), 6 mo 2 days ago  |
| Last failed build (#6), 6 mo 3 days ago       |
| Last unsuccessful build (#7), 6 mo 3 days ago |
| Last completed build (#11), 6 mo 2 days ago   |
+-----------------------------------------------+

注意事项

我们的需求具有特殊性,在 Jenkins Pipeline 中发送 IRC 消息,所以这种方案是可以接受的。

参考文献

terminal - How can I create a message box from the command line? - Unix & Linux Stack Exchange
printf - bash script , echo output in box - Unix & Linux Stack Exchange
How to generate a border around a string in Bash shell script? - Stack Overflow


标签:多行,ago,Last,mo,days,build,20210226,11,IRC
来源: https://www.cnblogs.com/k4nz/p/14451708.html