Skip to main content

Table of Contents generated with DocToc

Introduction

bt-cheater is a general-purpose cheatsheet tool powered by python.

The tool provides a way search through snippets of text stored in plain-text files using keywords, and all from the commandline.

The search logic relies on a simple structure for the text: a cheat header and body, e.g.

# python ternary assignments # ternary # variables
    This is a note on python ternary variable assignments
# bash loops # loops
    This is text on bash loop structures
# civil # war # us
    Dates: Apr 12, 1861 - May 9, 1865

As illustrated above, the header is comprised of Cheat Terms, which are keywords delimited by octothorpes (#).

The whitespace padding is optional and improves readability.

Configuration file

cheater can read yaml config files formatted as:

search:
  paths:
    - ~/Documents/notes
    - ${HOME}/Documents/more_notes
    - ~/notes
  filters:
    - md
    - txt

These are the settings recognized by the tool:

Key Value
paths List of cheat file paths to search against
filters List of file extensions to search for

If no config file is specified, the tool will attempt to read one from the following locations, in order of precedence:

  • /etc/bt-cheater/config.yaml
  • ./config.yaml
  • ~/.bt-cheater/config.yaml

Usage

Usage: cheater find [OPTIONS] TOPICS...

  Find cheat notes according to keywords

Options:
  --version                     Show the version and exit.
  -e, --explode-topics          Write results to their own cheat files
  -c, --cheatfile TEXT          Manually specify cheat file(s) to search
                                against
  -p, --cheatfile-path TEXT     Manually specify cheat file paths to search
                                against
  -a, --any                     Any search term can occur in the topic header
                                (default is "all")
  -b, --search-body             Search against cheat note content instead of
                                topic headers
  --no-pause                    Do not pause between topic output
  --help                        Show this message and exit.

  Examples:
  bt-cheater find -c ~/Documents/cheats.md foo bar baz
  bt-cheater find -c ~/Documents/cheats.md foo bar baz
  bt-cheater -C my_special_config.yaml find -c ~/Documents/cheats.md foo bar baz

  If no config file is specified, the tool will attempt to read one from the
  following locations, in order of precedence:

  - /etc/bt-cheater/config.yaml 
  - ./config.yaml 
  - ~/.bt-cheater/config.yaml

Usage examples

Given: Your config file is configured to search through '~/Documents/notes' for cheat files, that is, your configuration file is ~/.bt-cheater/config.yaml, with contents:

search:
  paths:
    - ${HOME}/Documents/notes
  filters:
    - md
    - txt
  • You want to find topic headers containing the words foo bar and baz
    • bt-cheater find foo bar baz
  • You want to search a specific cheat file, ~/Documents/cheats.md, for topic headers containing the words foo bar and baz
    • bt-cheater find -c ~/Documents/cheats.md foo bar baz
  • Same as above, but you also want to specify your own configuration file my_special_config.yaml
    • bt-cheater -C my_special_config.yaml find -c ~/Documents/cheats.md foo bar baz
      Note: Because you explicitly specified the cheat file, any cheat paths defined in your config will be skipped

Tips

As bodies of text may overlap in their keyword designation, specifying multiple terms can help narrow down search results if you specify a search condition.

As such, the default search logic is all, where all search terms must occur in the topic header (logically equivalent to AND).

If you want to broaden your search criteria, use the -a/--any flag, instructing bt-cheater to consider any search term present in the topic header (logically equivalent to OR).

How do I get started?

Installation

Using Pip

  • Form pypi.org pip install bt-cheater
  • Directly from the repo pip install git+https://github.com/berttejeda/bert.cheater.git

Or clone this repo, switch to the project root cd bert.cheater, and pip install -e ., then calling python bertdotcheater/cli.py --help

Metadata

Release files for bt-cheater 2.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bt-cheater 2.1.0
File Size Uploaded Provenance Actions
bt-cheater-2.1.0.tar.gz 14.4 kB Without provenance Details for bt-cheater-2.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bt-cheater 2.1.0
File Interpreter ABI Platform Actions
bt_cheater-2.1.0-py3-none-any.whl Python 3 none any Details for bt_cheater-2.1.0-py3-none-any.whl

Total release size: 24.1 kB

Release files / bt-cheater-2.1.0.tar.gz

Download URL bt-cheater-2.1.0.tar.gz
Size 14.4 kB
Tags Source
SHA-256 checksum
How to use checksums
260e4c77e7ee9cfdebc8c239fd1116128329a12de842c0342b39a6e5eab27cdb
BLAKE2b-256 checksum
How to use checksums
19e9b10e89aea945441c51f0def2851bcd93794bbbb6ce08fba5a67e56d88957
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Release files / bt_cheater-2.1.0-py3-none-any.whl

Download URL bt_cheater-2.1.0-py3-none-any.whl
Size 9.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ee206b8e42940e3f2de77e008aa16a7e5922c76bf06bf5421707361be23a609c
BLAKE2b-256 checksum
How to use checksums
93ddfd2f70eaff2c6cafa3cd3cd1a08b13c1415bab79e90ab745609f9b34c1a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.12

Security for bt-cheater 2.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

2.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page