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
Constructors of classes which need direct access to configuration
now take Config class instance as parameter which will give them
better maintainability in the future
CHEAT_HIGHLIGHT has been added to Configuration class
Implemnted an assertion that `CHEAT_HIGHLIGHT` (if set) contains a value
that is acceptible to `termcolors`. This happens only once, upon the
invokation of `__main__`. If the assertion fails, `cheat` terminates
with an exit code of `1`.
- When using GFM code fences, strip the last line in addition to the
first
- Updated `README.md` to mention the new feature
- `minor` version-bump to `2.2.0`.
pypi responded with an HTTP 500 when uploading the last version of
`cheat`, and this seems to have caused some problems. No changes were
made in this commit other than incrementing the version number in an
attempt to resolve this.
This allows a fine-grained control of the dependencies, because it generates a wrapper script
that calls the specifiend function (i.e., main inside cheat/app.py)
The `setup.py` script no longer attempts to install files to privileged
system directories. (Previously, it attempted to do this in order to
enable command-line autocompletion.) In lieu of doing this within the
installer directly, I have simply included brief instructions explaining
how to configure this manually.
Version bumped accordingly.
Previously, `sheets.print()` would query the filesystem every time it
was invoked. This was inelegant, because it is called multiple times
every time `cheat` is executed. Thus, unnecessary calls were being made
out to the filesystem.
Now the result of that function is being buffered into a module variable
when it is executed the first time, and served from there thereafter. I
broke the "functional" paradigm to a degree by doing this, but it wasn't
worth the complexity of implementing proper memoization (decorators,
etc) for such a trivial case.
Bumped the version number accordingly.