Metadata-Version: 2.4
Name: gist-backup
Version: 0.1.1
Summary: Back up a local file to a GitHub Gist
Project-URL: Homepage, https://github.com/your-username/gist-backup
Project-URL: Issues, https://github.com/your-username/gist-backup/issues
License: MIT
Keywords: backup,cli,gist,github
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: System :: Archiving :: Backup
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# gist-backup

Back up a hardcoded local file to a GitHub Gist — create or update with a single command.

## Installation

```bash
pip install gist-backup
```

## Setup

Create a GitHub Personal Access Token with the **`gist`** scope:

1. Go to <https://github.com/settings/tokens>
2. Generate a new token (classic or fine-grained) with the `gist` scope
3. Export it in your shell:

```bash
export GITHUB_TOKEN="ghp_your_token_here"
```

## Hardcoded file

By default the package backs up `~/.bashrc`.  To change this, edit the
`BACKUP_FILE` constant at the top of `gist_backup/backup.py` before installing.

## Usage

### Command line

```bash
# Back up the default file
gist-backup

# Back up a different file
gist-backup --file ~/dotfiles/.vimrc

# Override description or make it public
gist-backup --description "My .bashrc backup" --public
```

### Python API

```python
import os
from gist_backup import backup

os.environ["GITHUB_TOKEN"] = "ghp_..."

url = backup()                              # uses BACKUP_FILE default
url = backup("~/.vimrc", public=False)     # custom path
print(url)
```

### Return value

Both the CLI and the `backup()` function return the Gist's HTML URL, e.g.:

```
https://gist.github.com/your-username/abc123def456
```

If a Gist containing the same filename already exists in your account it is
**updated** rather than duplicated.

## Configuration reference

| Constant | Default | Purpose |
|---|---|---|
| `BACKUP_FILE` | `~/.bashrc` | File to back up |
| `GIST_DESCRIPTION` | `"Automated backup via gist-backup"` | Gist description |
| `GIST_PUBLIC` | `False` | Make the Gist public |

## License

MIT
