openbsd is needlessly left out from this XDG_CONFIG_HOME check which caused the program to exit prematurely. go supports openbsd so there isn't any sensible reason to exclude it.
- Refactor `installer.clone` into new `repo.Clone` package and method.
- Refactor `sheets.isGitDir` into `repo.GitDir`.
Both of these changes read better, and will facilitate cleaner
architecture when `--update` is implemented.
Integrate `go-git` into the application, and use it to `git clone`
cheatsheets when the installer runs.
Previously, the installer required that `git` be installed on the system
`PATH`, so this change has to big advantages:
1. It removes that system dependency on `git`
2. It paves the way for implementing the `--update` command
Additionally, `cheat` now performs a `--depth=1` clone when installing
cheatsheets, which should at least somewhat improve installation times
(especially on slow network connections).
- Fix an issue whereby `make clean` filed to remove assets created by
`make generate`.
- Fix a subsequent issue whereby `make generate` was being run too late
in the `make build` target, which resulted in a build failure.
Fix an issue whereby a default installation (as created by the
installer) would (seemingly) fail to output colorized text, even when
the `-c` flag was passed.
The root cause of the problem was that the installer did not set a
default `style` for `chroma`, which in turn defaulted to using the `bw`
(black-and-white) style.
Thus, colorization actually *was* being applied with `-c` - it was
simply black and white!
Fix an issue whereby colorization would output ANSI codes if a pager was
not configured.
The solution here is to stop guessing about the state of the user's
system at runtime, as well as the user's intention. The installer now
chooses an appropriate installer when generating configs, and no longer
bothers searching for pagers at runtime.
Fix an issue whereby ANSI escape characters could appear in search
output when a pager was not configured.
The root cause of the problem was code that was overzealously applying
an underlying effect to search terms.
This commit simply rips out underlying entirely, both as means of
resolving this problem, and also simply for removing needless visual
noise from search output.
Modify `Sheets.Load` to not walk hidden directories like `.git`. This
optimization can potentially prevent thousands of system calls from
being made, because `.git` directories can contain many files.
Bury the `more` pager default on Linux in an effort to work around the
following problem:
https://github.com/cheat/cheat/issues/681#issuecomment-1201842334
We're satisficing for this kludge because it does not appear to be
possible to actually make `more` perform as expected in all
environments.