Skip to content

Latest commit

 

History

51 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple Text Compare 简单文本比较

使用方法

初始化

在使用程序之前,需要先进行初始化,生成配置文件后,才可以继续使用 stc conf --init

  • 注意,如果配置文件损坏需要重新初始化

配置

  • 获取配置
    • stc conf --list
  • 设置列宽
    • stc conf --code-width xx 代码列宽
    • stc conf --no-width xx 行号列宽
  • 设置less路径
    • stc conf --less-path xx
  • 设置inline 是否启用行内对比
    • stc conf --inline 设置为true
    • stc conf --inline=false 设置为false
  • 需要注意
    • --list/--init互斥,但是可以结合另外三个进行设置
      • --init结合其他,先初始化后更改
      • --list结合其他,先修改后展示

对比

stc diff <left_file> <right_file> [-p|--path <dir>] [--less] [--style <git|table>]

  • --path/-p参数说明
    • 当两个文件在同一路径内,可以使用该参数指定路径,避免left_fileright_file输入太长
  • --less
    • 是否启用less进行显示
  • --style
    • 输出格式,默认为git diff类型,可选为table,表示按照行行比较

终端显示说明

当前版本不会刷新终端显示,会在执行命令后在下方直接显示,或者转移到less显式

  • ANSI颜色渲染会判断是否在终端内,如果重定向则忽略ANSI染色

to-do

  • 宽度设置width
    • 使用stc conf功能进行设置
    • 配置表保存于~/stc_conf/stc.toml
  • 输出长度控制,启用--less参数,将输出转移到less,需提前安装否则会导致panic
  • 颜色标记
  • 行内对比
  • 增加类git diff输出
  • 新增终端显示

related crates

  • clap
    • 用于命令行参数设置与解析
  • similar
    • 文本比较
  • anyhow
    • 统一错误处理
  • unicode_width
    • 字符宽度处理,用于输出
  • serde
    • 序列化
  • toml
    • 配合serde进行序列化

About

a cli app for simple text comparion

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages