summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreth-p <32112321+eth-p@users.noreply.github.com>2018-09-14 09:11:40 -0700
committerDavid Peter <sharkdp@users.noreply.github.com>2018-09-14 18:30:43 +0200
commit254efac9c26ab6ca924ccb6a5a89f1ef3789b460 (patch)
treea029e91c9a46c960b5e2af569f552deeac732e05
parentdcec32211707946cc81abfc9d33dda53650899dc (diff)
Added section to README on using Cygwin.
-rw-r--r--README.md20
1 files changed, 20 insertions, 0 deletions
diff --git a/README.md b/README.md
index ec375c15..988c8ce1 100644
--- a/README.md
+++ b/README.md
@@ -288,6 +288,26 @@ well as in newer versions of bash. On earlier versions of Windows, you can use
don’t have any other pagers installed, you can disable paging entirely by passing `--paging=never`
or by setting `BAT_PAGER` to an empty string.
+### Cygwin
+
+`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)`
+
+This can be solved by creating a wrapper or adding the following function to your `.bash_profile` file:
+
+```shell
+bat() {
+ local index
+ local args=("$@")
+ for index in $(seq 0 ${#args[@]}) ; do
+ case "${args[index]}" in
+ -*) continue;;
+ *) [ -e "${args[index]}" ] && args[index]="$(cygpath --windows "${args[index]}")";;
+ esac
+ done
+ command bat "${args[@]}"
+}
+```
+
## Troubleshooting
### Terminals & colors