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文本处理

Download history 1/week @ 2024-06-07 130/week @ 2024-06-14 30/week @ 2024-06-21 1/week @ 2024-06-28 19/week @ 2024-07-05 179/week @ 2024-07-26 34/week @ 2024-08-02

每月 213 次下载
aki-txpr-macro 中使用

MIT/Apache

32KB
532

aki-mcolor

crate Docs Rust Version Apache2/MIT licensed Test ubu Test mac Test win

标记文本颜色的程序。

特性

  • 使用颜色标记文本。
  • 最低支持 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

快速安装

  1. 您可以将此安装到 cargo bin 路径
cargo install aki-mcolor
  1. 您可以构建 debian 软件包
cargo deb

并将 .deb 安装到您的本地 Debian 软件包仓库中。

示例

命令行示例 1

将标准输入文本中的 "ca" 标记为 红色,将 "b" 标记为 绿色

echo "abcabca" | aki-mcolor -r "ca" -g "b"

输出结果

out abcabca image

命令行示例 2

从 rustup 目标列表中提取 "arm",将 "musl" 标记为 绿色,将 "android" 标记为 青色

rustup target list | aki-mline -e arm | aki-mcolor -g "musl" -c "android"

输出结果

out rustup image

  • aki-mline:提取匹配行命令,类似于 grep。

命令行示例 3

您还可以进行多次相同的颜色匹配。

echo "abcdefg" | aki-mcolor -r "c" -g "d" -r "e"

库示例

有关库示例,请参阅 fn execute()

变更日志

此 crate 的变更日志在此处。

许可证

本项目采用 Apache 许可证 2.0 版或 MIT 许可证。

由您选择。

依赖项

约 3-4MB
~80K SLoC