Commit Graph

23 Commits

Author SHA1 Message Date
Chris Lane
87cba04ff2 chore: DRY out colorization code
Creates a `sheet.Colorize` method that DRYs out code that was duplicated
among `cmd_search` and `cmd_view`.
2020-02-15 16:11:15 -05:00
Chris Lane
bc623da74b feat: issue #260
Dramatically improves the usefulness of `--search` by outputting
"chunked" results. This removes the need (usually) to search and then
manually open a cheatsheet.
2020-02-15 15:56:25 -05:00
Chris Lane
a6c25d4b9c feat: --search improvements
- Deprecates the `Match` struct

- Applies syntax highlighting to search results output in a manner
  consistent with the 'View' output

- Refactors search to move colorization functionality outside of its
  concern
2020-02-15 14:42:06 -05:00
Chris Lane
e24ac2b385 chore: deprecates line numbers in search
Removes line numbers from search result output as part of the
refactoring effort.
2020-02-15 10:11:25 -05:00
Chris Lane
e0c35a74d4 chore: removes colorization from search
Deprecates `mgutz/ansi` and removes colorization from search as a first
step toward improving the functionality.
2020-02-15 10:01:44 -05:00
Chris Lane
506fb8be15 fix: XDG_CONFIG_HOME mishandling
Attempts to resolve an issue regarding automatic config file generation,
as referenced in #501. This issue is believed occur when
`XDG_CONFIG_HOME` is unset.
2020-01-30 19:59:35 -05:00
Chris Lane
408e944eea chore: refactors config.path (small)
Performs a minor refactoring on `config.Paths` to consistently use
`path.Join` when computing config directory paths. Previously, both
`path.Join` and `fmt.Sprintf` were being used, strictly due to an
oversight.
2020-01-30 19:45:02 -05:00
Chris Lane
8a313b92ca chore: implements unit-tests for config.Paths 2020-01-30 19:25:53 -05:00
Chris Lane
6912771c39 chore: refactors config.Paths
Refactors the reading of multiple envvars out of `config.Paths` in order
to facilitate cleaner unit-testing.
2020-01-30 18:48:36 -05:00
Chris Lane
313b5ebd27 feat: config auto-generation
`cheat` now attempts to auto-generate a config file if one cannot be
found on the filesystem.
2020-01-29 14:08:03 -05:00
Chris Lane
ca91b25b02 fix: logging on failed configs
Fixes an issue whereby the error message generated when a config file
could not be loaded (due to a symlink resolution failure) would fail to
print the config file path to `stderr`.
2020-01-29 14:05:27 -05:00
aperum
4cb7a3b42c add FreeBSD to the supported systems in config.Path (#528) 2020-01-25 14:33:15 -05:00
Chris Allen Lane
91f0d02de2
v3.3.0 (#525)
* feat: directory-scoped cheatpaths

`cheat` now searches for a `.cheat` directory in the current working
directory. If found, that directory is (temporarily) appended to the slice
of cheatpaths.

* makefile wip

* fix: appeases linter

Appeases linter (`go vet`) by adding quotation marks to YAML struct
tags.

* chore: modifies .gitignore

Adds `tag` to `.gitignore`

* feat: adds Makefile

Adds a `Makefile` for managing build-related tasks.

* chore: documents directory-local paths

Adds documentation regarding the new directory-local cheatpath
functionality.

* chore: updates dependencies

* chore: bumps version to 3.3.0

* chore: updates bin scripts

- Removes `build_release.sh`
- Places deprecation notice in `build_devel.sh`, as its purpose has been
  superceded by the `Makefile`.
2020-01-20 12:34:48 -05:00
Chris Lane
3afea0972c fix: colorization errors
- Corrects an error with `--search`. Previously, `--search` was not
  aware of whether it was outputted to a TTY, and would apply colorization
  at all times. This resulted in unwanted behavior when, for example,
  piping search results into a paginator.

- Corrects an error with `--color`. Previously, `--color` would be
  ignored if output was being written to a non-TTY. This made it
  impossible, for example, to `cheat tar --color | less -R`, as
  colorization would always be stripped. The behavior of `--color` has
  been modified such that it now behaves similarly to `--color=always` in
  other applications.
2019-11-23 13:47:08 -05:00
Stefan Cosma
a8e6fdb18a Properly trim path separators on Windows 2019-11-20 01:10:19 +01:00
Chris Lane
aeaf01e1de feat: implements --tags
Implements `--tags`, which lists all tags in use.
2019-11-14 21:56:11 -05:00
Chris Lane
d6ebe0799d fix: repairs broken config unit-tests
Repairs the `config` unit-tests which were broken with `3.0.4`. It does
so by providing a simple switch that allows us to disable the resolution
of filesystem symlinks when running tests.
2019-11-07 19:59:18 -05:00
Chris Lane
51aaaf3423 chore: removes the tj/front dependency
Removes the `tj/front` dependency due to licensing concerns. See #490.
2019-11-07 06:46:34 -05:00
Chris Lane
197ff58796 fix: comments out more broken tests
Comments out another test broken by `3.0.4`.
2019-11-05 20:02:16 -05:00
Chris Lane
b8f512aae8 fix: comments out broken test
Comments out a test that was broken with changes introduced in `3.0.4`.
2019-11-05 19:58:08 -05:00
Chris Lane
f7c093bec0 fix: resolves #474
Resolves #474, whereby `cheat` failed to resolve symlinks. The root
cause was that `path/filepath#Walk` simply does not resolve symlinks:

  https://golang.org/pkg/path/filepath/#Walk
2019-11-05 19:08:40 -05:00
Chris Lane
1dda796e7c fix: resolves #492
Fixes an issue whereby hidden files (like `.DS_Store`) may be wrongly
loaded as cheatsheets.
2019-11-05 18:44:47 -05:00
Chris Lane
e5114a3e76 Re-wrote from scratch in Golang
- Re-implemented the project in Golang, and deprecated Python entirely
- Implemented several new, long-requested features
- Refactored cheatsheets into a separate repository
2019-10-20 10:02:28 -04:00