Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 117 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,47 +1,141 @@
# pinry-cli

CLI tools comes to Pinry!
Command-line client for [Pinry](https://getpinry.com/) to create pins from image URLs or local image files.

# Feature
## Features

+ Add pin from local image file
+ Add pin from image url
+ Save pinry instance and token locally
- Add a pin from a local image file
- Add a pin from a remote URL
- Save Pinry instance URL and API token in a local config file

About [Get the Token](https://docs.getpinry.com/api/)
See Pinry API docs for token details: https://docs.getpinry.com/api/

# Install
## Installation

`pip install pinry-cli`
```bash
pip install pinry-cli
```

## Quick Start

1. Save your Pinry URL and token:

```bash
pinry config
```

2. Add a pin from URL:

```bash
pinry add "https://example.com/image.jpg" --board "inspiration" --tags "tag1,tag2"
```

3. Add a pin from local file:

# Usage
```bash
pinry add ./image.jpg --board "inspiration" --description "Sample pin"
```

## Command Reference

Entry point:

```bash
pinry [OPTIONS] COMMAND [ARGS]...
```

Get help:
### Global options

| Option | Short | Argument | Default | Description |
|---|---|---|---|---|
| `--config` | `-c` | `TEXT` | `~/.pinry-cli.config.json` | Path to config JSON file |
| `--help` | | | | Show help and exit |

## Commands

### `pinry config`

Create or overwrite the config file with your Pinry instance URL and token.

```bash
pinry [--config PATH] config [OPTIONS]
```
-> pinry

Usage: pinry [OPTIONS] COMMAND [ARGS]...

Options:
-c, --config TEXT config file path
--help Show this message and exit.

Commands:
add add file or url to pinry instance
config add host and token for pinry
| Option | Argument | Required | Default | Description |
|---|---|---|---|---|
| `--pinry_url` | `TEXT` | No* | Prompted | Pinry host URL (for example: `https://pin.example.com`) |
| `--token` | `TEXT` | No* | Prompted | API token from your Pinry profile |
| `--help` | | No | | Show help and exit |

`*` If not provided on the command line, Click prompts interactively.

Example (fully non-interactive):

```bash
pinry config --pinry_url "https://pin.example.com" --token "YOUR_TOKEN"
```

Add config (pinry host url and token):
### `pinry add`

Create a pin from a URL or a local file path.

```bash
pinry [--config PATH] add [OPTIONS] FILE_OR_URL
```
pinry config

Arguments:

| Argument | Type | Required | Description |
|---|---|---|---|
| `FILE_OR_URL` | `TEXT` | Yes | Local image path or URL beginning with `http` |

Options:

| Option | Short | Argument | Default | Description |
|---|---|---|---|---|
| `--board` | `-b` | `TEXT` | `None` | Board name |
| `--tags` | `-t` | `TEXT` | `""` | Comma-separated tags |
| `--description` | `-d` | `TEXT` | `""` | Pin description |
| `--referer` | `-r` | `TEXT` | `""` | Referer URL/text |
| `--help` | | | | Show help and exit |

Examples:

```bash
# Add from URL
pinry add "https://example.com/image.jpg" --board "recipes" --tags "food,dinner"

# Add from local file
pinry add ./photos/cake.jpg --board "recipes" --description "Chocolate cake"
```

Add a Pin:
## Configuration File

Default config file path:

```text
~/.pinry-cli.config.json
```
pinry add "https://pin.37soloist.com/media/c/a/caff442c3f9a0cd73c50272d40771b76/FL-kQgyXIAEQuTz
" --board "any-board" --tags tag1,tag2

Expected JSON shape:

```json
{
"token": "YOUR_TOKEN",
"pinry_url": "https://pin.example.com"
}
```

You can use a custom config path globally:

```bash
pinry --config /path/to/config.json add ./image.jpg
```

## Notes

- If `FILE_OR_URL` starts with `http`, the CLI treats it as a remote image URL.
- Otherwise, it treats `FILE_OR_URL` as a local file path and uploads the file.
- If the specified board does not exist, the CLI attempts to create it.