npryce / adr-tools

Command-line tools for working with Architecture Decision Records
Other
4.56k stars 578 forks source link

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

Open dburriss opened 5 years ago

dburriss commented 5 years ago

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 commented 5 years ago

Example output:

$ adr  
/usr/bin/adr-help: line 16: more: command not found
danallford92 commented 5 years ago

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 :)

npryce commented 5 years ago

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 commented 5 years ago

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

Abarbz commented 5 years ago

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

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

rernst76 commented 5 years ago

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

fschop commented 1 year ago

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.