on master help sign in
Added section to README on using Cygwin.
254efaceth-p
README.md+20
@@ -288,6 +288,26 @@ well as in newer versions of bash. On earlier versions of Windows, you can use
288don’t have any other pagers installed, you can disable paging entirely by passing `--paging=never`
288don’t have any other pagers installed, you can disable paging entirely by passing `--paging=never`
289or by setting `BAT_PAGER` to an empty string.
289or by setting `BAT_PAGER` to an empty string.
290
290
291+### Cygwin
292+
293+`bat` on Windows does not natively support Cygwin's unix-style paths (`/cygdrive/*`). When passed an absolute cygwin path as an argument, `bat` will encounter the following error: `The system cannot find the path specified. (os error 3)`
294+
295+This can be solved by creating a wrapper or adding the following function to your `.bash_profile` file:
296+
297+```shell
298+bat() {
299+ local index
300+ local args=("$@")
301+ for index in $(seq 0 ${#args[@]}) ; do
302+ case "${args[index]}" in
303+ -*) continue;;
304+ *) [ -e "${args[index]}" ] && args[index]="$(cygpath --windows "${args[index]}")";;
305+ esac
306+ done
307+ command bat "${args[@]}"
308+}
309+```
310+
291## Troubleshooting
311## Troubleshooting
292
312
293### Terminals & colors
313### Terminals & colors