Skip to main content

A CLI that gives you more granular control over bulk deletion of your Github gists.

Project description

gists-gone

Testing License versions

gists-gone is a command-line tool that gives you more granular control over bulk deletion of your Github gists.

For example, if you want to only delete your public Python gists:

gists-gone -l Python -v public

Getting started

Prerequisites

In order to use this tool you'll need a Github access token with the "Gists" user permissions (write).

Once you have this token you can pass it to the tool directly:

gists-gone --token ghp_abc123

... or you can create an environmental variable called GITHUB_API_TOKEN, the value of which is your access token.

Installation

pip install gists-gone

Usage

Deleting everything

To delete all your gists simply run the tool with no arguments:

gists-gone

You will get a warning message before proceeding (which can be overriden with the --force option, although I caution against this):

Are you sure you proceed with the deletion?
10 gists will be deleted.
[Y/n]

Filtering

gists-gone have 3 different options, all of which can be combined for specifying the type of gists to included in the deletion.

Languages

You can specify gists in particular languages you want deleted:

gists-gone --languages SQL Python

Note that the name of the languages is case-sensitive.

For gists you want deleted that that have no language (or Github doesn't recognise) you can specify Unknown:

gists-gone -l Unknown

Visbility

Using the -visibility option you can specify whether you want to delete public or private gists:

gists-gone -v private
gists-gone -v public

Date range

With the --date_range option you can specify to delete gists created on a particular date:

gists-gone -dr 2024-04-01

Or between two dates:

gists-gone -dr 2018-04-01 2024-01-01

Dates should be passed in YYYY-MM-DD format.

Examples

Deleting private gists created from 2020-01-01 onwards:

gists-gone -v private -dr 2020-01-01 2100-01-01

Deleting Rust gists created on a particular date:

gists-gone -l Rust -dr 2024-11-07

Limitations

Note that a maximum of 3000 gists can be retrieved by the tool at any one time, due to a limitation imposed by the API.

However you can simply rerun the tool after you've deleted some gists or if you're feeling fancy you can invoke the command multiple times with a loop:

for i in {1..5}
do
  gists-gone --force # Be careful with this option!
done

The Github API also has a personal rate limit of 5,000 requests per hour so bear in mind you'll have to wait an hour if you want to delete more than 3000 gists.

Roadmap

I would like to eventually add more options for specifying the types of gists to be deleted:

  • Filtering a gist's description using regex
  • Starred or unstarred
  • Updated date

Warning

I've done my best to unit test this tool as thoroughly as possible but as there is no way to retrieve a gist once it's deleted I caution you to not use this tool if you have any particularly important or sensitive gists that you do not want accidentally deleted.

I do not take responsibility for any unintended outcomes or damages.

That said, if you do notice anything wrong please raise an issue!

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

gists_gone-0.0.1.tar.gz (8.5 kB view details)

Uploaded Source

Built Distribution

gists_gone-0.0.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file gists_gone-0.0.1.tar.gz.

File metadata

  • Download URL: gists_gone-0.0.1.tar.gz
  • Upload date:
  • Size: 8.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.2

File hashes

Hashes for gists_gone-0.0.1.tar.gz
Algorithm Hash digest
SHA256 cf8e4478db2032c74d32a3b23eb3dac09378689929c88aa48711a90447c7972d
MD5 4649dc033852b65b04e3d0abdb7ba03e
BLAKE2b-256 6e5e9f630322c4342df9600787131a0363805a19c48f3d3eeedcaad92ca396c2

See more details on using hashes here.

File details

Details for the file gists_gone-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: gists_gone-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.10.2

File hashes

Hashes for gists_gone-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 bb690416e7d7a432be6c89b931828a765731b5cf7cd56ef4aef975aa326ceba8
MD5 003ed46959b71ad3b0a07d4e85138be6
BLAKE2b-256 1efe6e8bc4eb92a590a71d6d9003eaaf348961fe44a93d039f0e8d4b993e5ae5

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