The prior attempt to resolve#420 and #431 relied on `appdirs` to
determine the appropriate directories into which to install files.
Previously, `setup.py` dynamically attempted to install `appdirs` via
`pip` during installation if necessary.
This attempt to failed on multiple platforms, however, due to
backwards-incompatible `pip` interfaces.
As a workaround, I have now directly included `appdirs` (a small module)
within `cheat` itself. This approach is explicitly supported per the
`appdirs` documentation:
https://pypi.org/project/appdirs/
Resolves the following:
- #351 (use of `sudo` when installing)
- #420 (failure to install on Windows)
- #431 (failure to install on MacOS)
Application now relies on `appdirs` module to identify the appropriate
locations for storing configuration and data, both during installation
and runtime.
This doesn't give an SSH shell, but just forwards the ports - which is what one usually requires when setting up a SOCKS proxy.
The -q is to suppress messages etc.
- Added `ci/lint.sh`, which uses `flake8` to lint the relevant files
- Made changes to appease the linter.
- Bugfix in `cheat/configuration` (missing dependency)
Refactored `Sheet` class:
- Removed unnecessary indirection and extraneous methods
- Renamed some methods to conform to Pythonic conventions
- Renamed the `create_or_edit` method to `edit` to be consistent with
subcommand name (`--edit`)
- Extracted `Colorize` class out of `Util` class. (The latter now only
contains static methods.)
- Renamed methods in `Colorize` class for improved clarity.
- Refactored as necessary to accommodate the changes above.
Performed a general refactoring, focusing on the following:
- Removing layers of abstraction in config handling
- Stubbing out proper config validator
- Updating envvar names located throughout the project
Added a missing `termcolor` dependency to `install_requires` in
`setup.py`. `termcolors` was introduced as an optional dependency when
the `CHEAT_HIGHLIGHT` envvar was implemented.
PR #391 changed the locaton into which system-wide cheatsheets are
installed to `/usr/share/cheat`, in order to comply with FHS. However,
this is causing conflicts with the `snap` packaging process.
This commit removes hard-coded references to `/usr/share/cheat` (outside
of `config/cheat`), and instead reads the cheat path via the
`CHEAT_PATH` config value (which may be set either in `cheat/config`, or
exported as an environment variable).
Lastly, this commit makes `setup.py` "aware of" the `CHEAT_PATH` env
var, allowing us to specify to where sytem-wide cheatsheets should be
installed during the `snap` build.
Previous pull-requests #406 and #413 attempted to resolve#372. They
were, however, never merged in.
Given that #391 was just merged (which rewrites a significant amount of
prior code), I here took what we learned from #406 and #413 and
re-implemented it. This approach will be less error-prone than
attempting to rebase either of the former on the changes introduced in
#391.