21 个版本
0.1.32 | 2024 年 6 月 19 日 |
---|---|
0.1.31 | 2023 年 1 月 11 日 |
0.1.30 | 2022 年 6 月 27 日 |
0.1.27 | 2021 年 11 月 15 日 |
0.1.19 | 2021 年 3 月 22 日 |
#276 在 文本处理
每月 213 次下载
在 aki-txpr-macro 中使用
32KB
532 行
aki-mcolor
标记文本颜色的程序。
特性
- 使用颜色标记文本。
- 最低支持 rustc 1.58.1 (db9d1b20b 2022-01-20)
命令帮助
aki-mcolor --help
Usage:
aki-mcolor [options]
mark up text with color
Options:
-r, --red <exp> write it in red
-g, --green <exp> write it in green
-b, --blue <exp> write it in blue
-c, --cyan <exp> write it in cyan
-m, --magenda <exp> write it in magenda
-y, --yellow <exp> write it in yellow
-u, --unmark <exp> write it in non-color
-H, --help display this help and exit
-V, --version display version information and exit
Option Parameters:
<exp> regular expression, color the entire match.
Environments:
AKI_MCOLOR_COLOR_SEQ_RED_ST red start sequence specified by ansi
AKI_MCOLOR_COLOR_SEQ_GREEN_ST greep start sequence specified by ansi
AKI_MCOLOR_COLOR_SEQ_BLUE_ST blue start sequence specified by ansi
AKI_MCOLOR_COLOR_SEQ_CYAN_ST cyan start sequence specified by ansi
AKI_MCOLOR_COLOR_SEQ_MAGENDA_ST magenda start sequence specified by ansi
AKI_MCOLOR_COLOR_SEQ_YELLOW_ST yellow start sequence specified by ansi
AKI_MCOLOR_COLOR_SEQ_ED color end sequence specified by ansi
快速安装
- 您可以将此安装到 cargo bin 路径
cargo install aki-mcolor
- 您可以构建 debian 软件包
cargo deb
并将 .deb 安装到您的本地 Debian 软件包仓库中。
示例
命令行示例 1
将标准输入文本中的 "ca
" 标记为 红色,将 "b
" 标记为 绿色。
echo "abcabca" | aki-mcolor -r "ca" -g "b"
输出结果
命令行示例 2
从 rustup 目标列表中提取 "arm
",将 "musl
" 标记为 绿色,将 "android
" 标记为 青色。
rustup target list | aki-mline -e arm | aki-mcolor -g "musl" -c "android"
输出结果
- aki-mline:提取匹配行命令,类似于 grep。
命令行示例 3
您还可以进行多次相同的颜色匹配。
echo "abcdefg" | aki-mcolor -r "c" -g "d" -r "e"
库示例
有关库示例,请参阅 fn execute()
。
变更日志
许可证
本项目采用 Apache 许可证 2.0 版或 MIT 许可证。
- LICENSE-APACHE 或 https://apache.ac.cn/licenses/LICENSE-2.0
- LICENSE-MIT 或 https://opensource.org/licenses/MIT
由您选择。
依赖项
约 3-4MB
~80K SLoC