我想使用 cli 工具进行文件比较,并且在输出行之前需要行号,这有助于我可以跳转到行差异,因为我使用的工具可以了解跳转的位置,如果行是这样开始的 :line-number: regular line contents
所以我尝试了diff
,阅读文档似乎是可能的:
-D, --ifdef=NAME output merged file with `#ifdef NAME' diffs
--GTYPE-group-format=GFMT format GTYPE input groups with GFMT
--line-format=LFMT format all input lines with LFMT
--LTYPE-line-format=LFMT format LTYPE input lines with LFMT
These format options provide fine-grained control over the output
of diff, generalizing -D/--ifdef.
LTYPE is `old', `new', or `unchanged'. GTYPE is LTYPE or `changed'.
GFMT (only) may contain:
%< lines from FILE1
%> lines from FILE2
%= lines common to …
Run Code Online (Sandbox Code Playgroud) diff ×1