A Python tool to interact with GitHub Gists
Project description
Pygister
A Python tool to interact with GitHub Gists. This tool allows you to create, read, update, and sync Gists directly from the command line.
Features
- Create a new Gist from a local file.
- Read the content of a Gist by its ID.
- Update an existing Gist with the content of a local file.
- Synchronize a local file with a remote Gist, keeping them in sync at regular intervals.
- Print the version of the
pygister
library.
Installation
Using pip
You can install pygister
directly from the source:
pip install -e .
Using setup.py
To install using the setup.py
script:
python setup.py install
Usage
Command Line Interface
Print the version
To print the version of the pygister
library:
pygist version
Create a Gist
To create a new Gist from a local file and return the short URL of the new Gist:
pygist push <filename>
Read a Gist
To read the content of a Gist by its ID and print it to stdout:
pygist read <ID>
Update a Gist
To update an existing Gist with the content of a local file:
pygist push <filename> <ID>
Sync a Local File with a Gist
To synchronize a local file with a remote Gist every specified number of seconds:
pygist sync <ID> <Seconds>
- If the local file does not exist, it will be created.
- If the local file is newer, it will update the Gist.
- If the Gist is newer, it will update the local file.
- The process will run in a loop every
<Seconds>
and will gracefully shut down on receivingCTRL-C
.
Example Usage
-
Create a Gist:
pygist push example.txt
-
Read a Gist:
pygist read 1234567890abcdef1234567890abcdef
-
Update a Gist:
pygist push example.txt 1234567890abcdef1234567890abcdef
-
Sync a Local File with a Gist:
pygist sync 1234567890abcdef1234567890abcdef 60
This command will sync the local file associated with the Gist ID every 60 seconds.
Development
Running Tests
To run tests:
pytest
Linting and Formatting
To lint and format the code:
make lint
Type Checking
To perform type checking:
make type-check
License
This project is licensed under the MIT License. See the LICENSE file for more details.
Author
Farshid Ashouri - farsheed.ashouri@gmail.com
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
Built Distribution
File details
Details for the file pygister-0.1.5.tar.gz
.
File metadata
- Download URL: pygister-0.1.5.tar.gz
- Upload date:
- Size: 8.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd9917e32aca431299ab0449f0c3e18eb56fcb941c1d04a11486fef998e73909 |
|
MD5 | 0c13bc454ee2770f1b54404ad8f28542 |
|
BLAKE2b-256 | c762688b727f58aecd55308477e5a0a7d33d2d5972eacf70a57817310003a53d |
File details
Details for the file pygister-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: pygister-0.1.5-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c608fc495dc068b20d84ec00053af37b752279e654d5a565e4dbfa434c2f33c |
|
MD5 | c46e222652b0ed027766fd8c10f1a0b3 |
|
BLAKE2b-256 | 8a30428098ec9afdc386844f4269fc8eb974e1b1382fe84d28f9319d00109172 |