adr-tools icon indicating copy to clipboard operation
adr-tools copied to clipboard

Change in 2.2.0 to use of "-more" in help does not work in Git Bash

Open dburriss opened this issue 6 years ago • 7 comments

ad-help changed in 2.2.0 to use PAGER:-more which results in more command not available error when using Git Bash on Windows. Prior to this it did work.

dburriss avatar Sep 28 '18 08:09 dburriss

Example output:

$ adr  
/usr/bin/adr-help: line 16: more: command not found

dburriss avatar Sep 28 '18 09:09 dburriss

Hi @dburriss, "more" is the default pager for the help output. From reading around, git bash on windows doesnt have more installed by default but does have less installed by default.

You can set the default pager to be used by setting the environment variable to ADR_PAGER.

putting export ADR_PAGER=less into your .bash_profile should fix the issue.

Hope that helps :)

danallford92 avatar Sep 29 '18 22:09 danallford92

more is defined by the POSIX standard, and less is not. It’s not practical to support non-standard environments.

How about if the pager does not exist it falls back to no pager, and it’s up to the user to pipe it through whatever pager exists in their environment?

npryce avatar Oct 05 '18 20:10 npryce

For now, I've updated the installation instruction for Git for Windows

npryce avatar Oct 08 '18 17:10 npryce

For now, I've updated the installation instruction for Git for Windows

This last step could be made (much) clearer ;)

Abarbz avatar Nov 09 '18 15:11 Abarbz

For what it's worth, I found it easier to just edit adr-help locally

from: pager="${ADR_PAGER:-${PAGER:-more}}" to: pager="${ADR_PAGER:-${PAGER:-less}}"

This worked really well using a fresh install of git for windows 2.20.1

rernst76 avatar Jan 16 '19 00:01 rernst76

Since 'less' is not POSIX compliant, and 'more' is not available in Git Bash, this might be a better workaround: from: pager="${ADR_PAGER:-${PAGER:-more}}" to: pager="${ADR_PAGER:-${PAGER:-cat}}"

If the user wants paging, he/she should define PAGER.

fschop avatar Jan 30 '23 08:01 fschop