Skip to main content

grep for GroupMe

Project description

GrepMe

Grep for GroupMe

Build Status Code style: black

For something similar that runs in the browser, take a look at https://www.searchme.co/ instead.

For Users

Elevator pitch

Do you wish GroupMe had a search function? Me too. That's why I wrote GrepMe, a command line search tool for GroupMe that's featureful and easy to use.

Installing

  1. pip install grepme
  2. Create your login token on https://dev.groupme.com/applications -> Create Application None of the info there is used in grepme, you can give garbage values.
  3. Run grepme. You should be prompted for your login token.

If you type your token wrong, you can use -D and grepme will prompt you again, e.g. grepme -D some_text

Examples

  • Search case-insensitive for 'school': grepme -i school
  • Show every message from every group you're in: grepme '.*'
  • Search in a specific group: grepme --group USCCyber api
  • Filter by date: grepme -d '.*' | grep 2018
  • Search by user: grepme -u Joshua '.*'
  • Show all available groups: grepme -l
  • Show version: grepme -V
  • Show messages newer than 1 week: grepme --json '.*' | jq -r "select(.created_at > $(date -d '1 week ago' +%s)) | .text"
  • Show at most 10 messages: grepme --json '.*' | head -n 10 | jq -r '.name, .text'

See it in action

$ grepme -i swear --group 'ACM$'
Huиter Damroи: I work in the IBM building but I can meet you at Swearingen or anywhere.
Matthew Clapp: Is anybody in Swearingen?
ℬℜΔƉѰ: Can someone confirm that the Airport monitors in Swearingen have a Code-a-thon announcement?
Justin Baum: Hey does anyone know who I should email so my Carolina Card can get me into Swearingen?
^C

Configuration

GrepMe uses configparse for configuration, see its documentation for details. For example, I use the following configuration in ~/.config/grepme.toml, which searches only in 'ACM' by default:

group = "^ACM$"

Full usage

usage: grepme [-h] [-g GROUP] [-l] [-q] [-d] [-i] [-a AFTER_CONTEXT]
              [-b BEFORE_CONTEXT] [-c CONTEXT] [-u USER] [-o] [-v] [-V] [-D]
              [--clear-cache] [--color | --no-color] [--json] [-f | -F]
              regex [regex ...]

grep for groupme, version 1.3.5

positional arguments:
  regex                 text to search

optional arguments:
  -h, --help            show this help message and exit
  -g GROUP, --group GROUP
                        group to search. can be specified multiple times
  -l, --list            show all available groups and exit
  -q, --quiet           don't show who said something
  -d, --date            show the date a message was sent
  -i, --ignore-case     ignore case distinctions in both text and groups
  -a AFTER_CONTEXT, -A AFTER_CONTEXT, --after-context AFTER_CONTEXT
                        show the following n messages after a match
  -b BEFORE_CONTEXT, -B BEFORE_CONTEXT, --before-context BEFORE_CONTEXT
                        show the previous n messages before a match
  -c CONTEXT, -C CONTEXT, --context CONTEXT
                        show n messages around a match. overrides -A and -B.
  -u USER, --user USER  search by username. can be specified multiple times
  -o, --only-matching   only show text that matched, not the whole message
  -v, --reverse-matching
                        only show messages that didn't match
  -V, --version         show version
  -D, --delete-cached   delete cached credentials. useful if you mistype in
                        the inital login prompt
  --clear-cache         delete cached message. you should very rarely have to
                        use this option
  --color               always color output
  --no-color            never color output
  --json                print messages as JSON
  -f, --favorited, --liked
                        only show liked messages
  -F, --not-favorited, --not-liked
                        never show liked messages

Unicode is handled fine, see examples above.

For Developers

Testing

  1. pip install -r dev-requirements.txt
  2. test/pre-commit

If you see any test failures, it's a bug! Please let me know: https://github.com/jyn514/GrepMe/issues If you have suggestions for more tests, those are also welcome.

Contributing

Fork the repository, make some changes, make a pull request. Note: the script test/pre-commit will be run on any commit. You may want to run it automatically yourself: ln -s ../test/pre-commit .git/hooks

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grepme-1.4.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

grepme-1.4.0-py2.py3-none-any.whl (20.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file grepme-1.4.0.tar.gz.

File metadata

  • Download URL: grepme-1.4.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for grepme-1.4.0.tar.gz
Algorithm Hash digest
SHA256 82c422e093a24bd4eb13d8910447db53aafb3db7e26676cdc354372857f022cd
MD5 52856f6c6fc8cdfd800a15913dae1226
BLAKE2b-256 78dc18cd3dec75ca232f7ddb0ef90ab4d959804c4e7c316c2a9ce302f23ae2e7

See more details on using hashes here.

File details

Details for the file grepme-1.4.0-py2.py3-none-any.whl.

File metadata

  • Download URL: grepme-1.4.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.7.3

File hashes

Hashes for grepme-1.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 0761cb93af7d3c7914ff66552da8754d768ff9954c29cc2e959cd1eead93fbbb
MD5 7ffa797e363950ddb25acb99dad23761
BLAKE2b-256 e062a72d0e5df2c2a3e5ee232cba8ec98236b2711661c374125e4643790e6ce1

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page