在 Windows 10 的 GitBash 上,如何設定 ag(銀色搜尋器)來列印出現字串的檔案?

在 Windows 10 的 GitBash 上,如何設定 ag(銀色搜尋器)來列印出現字串的檔案?

我在 Windows 10 上使用 GitBash。

$ ag --version
ag version 2.2.5 ; Windows port 2021-06-04 Win64 >= Server2003 amd64
MsvcLibX 2021-06-03 ; PCRE 8.44 2020-02-12 ; pthreads4w 3.0.0 ; zlib 1.2.11

Features:
  +jit -lzma +zlib +2enc

但是,當我在 GitBash 中使用該實用程式時,它不會列印出現搜尋字串的文件,

$ echo '你好' > /tmp/文件

MYUSER@ABCDEf XYZGW64 ~/Documents/workspace/finance-uimodule-customersetup (dev/POAWS-3048_part2)
$ ag 'hello' /tmp
hello

如何配置 silver searcher (ag),以便在進行搜尋時列印出實際字串出現的檔案?

答案1

嘗試使用以下命令包裝它winpty


    winpty ag 'hello' /tmp

參考號:https://gist.github.com/DeanPDX/acff533cff0cfbda2761d1e62e8cb1a7#getting-npm-colors--progress-working

相關內容