Skip to content

Commit 54548f1

Browse files
Add non-interactive flags for shelf, collection, and mark commands (#24)
* feat: non-interactive paths for all subcommands * chore: tests + helper function * chore: version bump
1 parent 59f2fdc commit 54548f1

15 files changed

Lines changed: 1115 additions & 98 deletions

File tree

README.md

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ Bookmarks ship with stable identifiers (`catalog_id`), full-text search (`book m
1818
## Quick Demo
1919

2020
```bash
21-
book shelf add # add a shelf interactively
22-
book collection add # add a collection to a shelf
21+
book shelf add --name dev # add a shelf non-interactively
22+
book collection add --shelf dev --name docs # add a collection to a shelf
2323
book mark add https://example.com # add a bookmark (fetches title)
2424
book mark add https://example.com --shelf dev --collection tools --tags go,cli
2525
book shelf list # one name per line; pipe into fzf
@@ -60,7 +60,16 @@ go build .
6060
book --interactive mark add https://example.com
6161
```
6262

63-
2. **Add a bookmark non-interactively:**
63+
2. **Manage shelves and collections non-interactively:**
64+
65+
```bash
66+
book shelf add --name dev --description "software bookmarks"
67+
book collection add --shelf dev --name docs
68+
book shelf remove --name dev --confirm
69+
book collection remove --shelf dev --name docs --confirm
70+
```
71+
72+
3. **Add, edit, get, and remove bookmarks non-interactively:**
6473

6574
```bash
6675
book mark add \
@@ -69,9 +78,13 @@ go build .
6978
--collection docs \
7079
--title "Effective Go" \
7180
--tags go,best-practices
81+
82+
book mark get --id <catalog_id>
83+
book mark edit --id <catalog_id> --tags go,best-practices
84+
book mark remove --id <catalog_id> --confirm
7285
```
7386

74-
3. **List your bookmarks:**
87+
4. **List your bookmarks:**
7588

7689
Plain-text defaults are pipe-friendly and require no flags:
7790

@@ -87,6 +100,7 @@ go build .
87100
book shelf list --format json
88101
book collection list --shelf dev --format json
89102
book mark list --shelf dev --collection docs --format json
103+
book mark get --id <catalog_id> --format json
90104
```
91105

92106
## How It Works
@@ -134,18 +148,18 @@ collection_desc = "language and framework docs"
134148

135149
| Command | What it does |
136150
| --- | --- |
137-
| `shelf add` | Add a new shelf |
151+
| `shelf add --name <name>` | Add a new shelf (falls back to TUI when `--interactive`) |
138152
| `shelf list` | List all shelves |
139-
| `shelf remove` | Remove a shelf |
140-
| `collection add` | Add a new collection |
141-
| `collection list` | List collections in a shelf |
142-
| `collection remove` | Remove a collection |
153+
| `shelf remove --name <name> --confirm` | Remove a shelf |
154+
| `collection add --shelf <shelf> --name <name>` | Add a new collection (falls back to TUI when `--interactive`) |
155+
| `collection list --shelf <shelf>` | List collections in a shelf |
156+
| `collection remove --shelf <shelf> --name <name> --confirm` | Remove a collection |
143157
| `mark add <url>` | Add a bookmark (optionally non-interactive) |
144-
| `mark edit` | Edit an existing bookmark (TUI) |
145-
| `mark get` | Browse bookmarks and open one (TUI) |
146-
| `mark list` | List bookmarks in a collection (`--trash` lists soft-deleted) |
158+
| `mark edit --id <id> [--title/--tags/--url]` | Edit an existing bookmark (falls back to TUI when `--interactive`) |
159+
| `mark get --id <id>` | Show a bookmark (falls back to TUI when `--interactive`) |
160+
| `mark list --shelf <shelf> --collection <collection>` | List bookmarks in a collection (`--trash` lists soft-deleted) |
147161
| `mark search <query>` | Full-text search by title, URL, or tags |
148-
| `mark remove` | Soft-delete a bookmark (TUI) |
162+
| `mark remove --id <id> --confirm` | Soft-delete a bookmark (falls back to TUI when `--interactive`) |
149163
| `mark restore` | Restore a soft-deleted bookmark (`--id`, or `--shelf`/`--collection`/`--url`) |
150164
| `migrate` | Upgrade v1 shelf files to the v2 schema |
151165
| `gc` | Purge soft-deleted marks past the retention window |
@@ -167,7 +181,7 @@ collection_desc = "language and framework docs"
167181
| `--theme-file <path>` | `$XDG_CONFIG_HOME/book/theme.json` | Theme JSON path |
168182
| `--template-file <path>` | `$XDG_CONFIG_HOME/book/template.json` | Template JSON path |
169183
| `--catalog-format` | `toml` | Shelf file format (only `toml` supported) |
170-
| `--format <fmt>` || Opt into structured output for `list` commands (`json` or `toml`; default is one line per item) |
184+
| `--format <fmt>` || Opt into structured output for `list` and `mark get` (`json` or `toml`; default is human-readable text) |
171185

172186
## Configuration
173187

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
v1.2.2
1+
v1.3.0

0 commit comments

Comments
 (0)