Skip to content

Commit f36226f

Browse files
committed
feat(docs): add structural and segment editing
1 parent 14e682a commit f36226f

43 files changed

Lines changed: 2415 additions & 141 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
### Added
66

7+
- Docs: add first-class footnote, section-break, horizontal-rule, and section-column commands with shared index, anchor, tab, dry-run, and batch behavior where supported. (#856) — thanks @sebsnyk.
8+
- Docs: add header/footer lifecycle commands plus segment-aware plain-text insert, update, delete, format, and range lookup across headers, footers, and footnotes. (#857) — thanks @sebsnyk.
79
- Docs: add table cell borders, padding, and vertical content alignment to `docs cell-style`. (#855) — thanks @sebsnyk.
810
- Docs: add minimum height and page-overflow controls to `docs table-row style`. (#855) — thanks @sebsnyk.
911
- Docs: add `docs table-row pin-header --rows N` for pinning or unpinning repeated table header rows. (#855) — thanks @sebsnyk.

docs/commands.generated.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,15 @@ Generated from `gog schema --json`.
246246
- [`gog docs (doc) export (download,dl) <docId> [flags]`](commands/gog-docs-export.md) - Export a Google Doc (pdf|docx|txt|md|html)
247247
- [`gog docs (doc) find-range <docId> <text> [flags]`](commands/gog-docs-find-range.md) - Find text and print Docs API UTF-16 index ranges
248248
- [`gog docs (doc) find-replace <docId> <find> [<replace>] [flags]`](commands/gog-docs-find-replace.md) - Find and replace text. Supports plain text or markdown with images; use --first for a single occurrence.
249+
- [`gog docs (doc) footer (footers) <command>`](commands/gog-docs-footer.md) - List, create, or delete document footers
250+
- [`gog docs (doc) footer (footers) create (add,new) <docId> [flags]`](commands/gog-docs-footer-create.md) - Create and optionally populate a footer
251+
- [`gog docs (doc) footer (footers) delete (rm,remove,del) <docId> <footerId> [flags]`](commands/gog-docs-footer-delete.md) - Delete a footer
252+
- [`gog docs (doc) footer (footers) list (ls) <docId> [flags]`](commands/gog-docs-footer-list.md) - List footers and their segment IDs
249253
- [`gog docs (doc) format <docId> [flags]`](commands/gog-docs-format.md) - Apply text or paragraph formatting to a Google Doc
254+
- [`gog docs (doc) header (headers) <command>`](commands/gog-docs-header.md) - List, create, or delete document headers
255+
- [`gog docs (doc) header (headers) create (add,new) <docId> [flags]`](commands/gog-docs-header-create.md) - Create and optionally populate a header
256+
- [`gog docs (doc) header (headers) delete (rm,remove,del) <docId> <headerId> [flags]`](commands/gog-docs-header-delete.md) - Delete a header
257+
- [`gog docs (doc) header (headers) list (ls) <docId> [flags]`](commands/gog-docs-header-list.md) - List headers and their segment IDs
250258
- [`gog docs (doc) headings <command>`](commands/gog-docs-headings.md) - List document headings
251259
- [`gog docs (doc) headings list (ls) <docId> [flags]`](commands/gog-docs-headings-list.md) - List heading paragraphs
252260
- [`gog docs (doc) images <command>`](commands/gog-docs-images.md) - List document images
@@ -255,9 +263,12 @@ Generated from `gog schema --json`.
255263
- [`gog docs (doc) insert <docId> [<content>] [flags]`](commands/gog-docs-insert.md) - Insert text at a specific position
256264
- [`gog docs (doc) insert-date-chip --date=STRING <docId> [flags]`](commands/gog-docs-insert-date-chip.md) - Insert a native date smart chip
257265
- [`gog docs (doc) insert-file-chip (insert-rich-link) --file-id=STRING <docId> [flags]`](commands/gog-docs-insert-file-chip.md) - Insert a native Drive file smart chip
266+
- [`gog docs (doc) insert-footnote <docId> [flags]`](commands/gog-docs-insert-footnote.md) - Insert and populate a footnote
267+
- [`gog docs (doc) insert-horizontal-rule (insert-hr,hr) <docId> [flags]`](commands/gog-docs-insert-horizontal-rule.md) - Insert a paragraph-border horizontal rule
258268
- [`gog docs (doc) insert-image <docId> [flags]`](commands/gog-docs-insert-image.md) - Insert a public image URL or upload a local image into a Google Doc
259269
- [`gog docs (doc) insert-page-break (page-break,pb) <docId> [flags]`](commands/gog-docs-insert-page-break.md) - Insert a page break at a specific position (or end-of-doc with --at-end)
260270
- [`gog docs (doc) insert-person --email=STRING <docId> [flags]`](commands/gog-docs-insert-person.md) - Insert a native person smart chip
271+
- [`gog docs (doc) insert-section-break <docId> [flags]`](commands/gog-docs-insert-section-break.md) - Insert a continuous or next-page section break
261272
- [`gog docs (doc) insert-table --rows=INT --cols=INT <docId> [flags]`](commands/gog-docs-insert-table.md) - Insert a native table at a specific position (or end-of-doc with --at-end), optionally populated via --values-json
262273
- [`gog docs (doc) list-tabs <docId>`](commands/gog-docs-list-tabs.md) - List all tabs in a Google Doc
263274
- [`gog docs (doc) named-range (named-ranges,namedranges,nr) <command>`](commands/gog-docs-named-range.md) - Manage named ranges
@@ -271,6 +282,7 @@ Generated from `gog schema --json`.
271282
- [`gog docs (doc) raw <docId> [flags]`](commands/gog-docs-raw.md) - Dump raw Google Docs API response as JSON (Documents.Get; lossless; for scripting and LLM consumption)
272283
- [`gog docs (doc) rename-tab <docId> [flags]`](commands/gog-docs-rename-tab.md) - Rename a tab in a Google Doc
273284
- [`gog docs (doc) replace-image <docId> [flags]`](commands/gog-docs-replace-image.md) - Replace an existing image without changing its position or bounds
285+
- [`gog docs (doc) section-columns --count=INT <docId> [flags]`](commands/gog-docs-section-columns.md) - Set the column count for a document section
274286
- [`gog docs (doc) sed <docId> [<expression>] [flags]`](commands/gog-docs-sed.md) - Regex find/replace (sed-style: s/pattern/replacement/g)
275287
- [`gog docs (doc) structure (struct) <docId> [flags]`](commands/gog-docs-structure.md) - Show document structure with numbered paragraphs
276288
- [`gog docs (doc) table-column <command>`](commands/gog-docs-table-column.md) - Insert or delete native table columns

docs/commands/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Every `gog` command has a generated docs page. The source of truth is the live CLI schema; run `make docs-commands` after changing command names, flags, help text, aliases, or arguments.
44

5-
Generated pages: 682.
5+
Generated pages: 694.
66

77
## Top-level Commands
88

@@ -297,7 +297,15 @@ Generated pages: 682.
297297
- [gog docs export](gog-docs-export.md) - Export a Google Doc (pdf|docx|txt|md|html)
298298
- [gog docs find-range](gog-docs-find-range.md) - Find text and print Docs API UTF-16 index ranges
299299
- [gog docs find-replace](gog-docs-find-replace.md) - Find and replace text. Supports plain text or markdown with images; use --first for a single occurrence.
300+
- [gog docs footer](gog-docs-footer.md) - List, create, or delete document footers
301+
- [gog docs footer create](gog-docs-footer-create.md) - Create and optionally populate a footer
302+
- [gog docs footer delete](gog-docs-footer-delete.md) - Delete a footer
303+
- [gog docs footer list](gog-docs-footer-list.md) - List footers and their segment IDs
300304
- [gog docs format](gog-docs-format.md) - Apply text or paragraph formatting to a Google Doc
305+
- [gog docs header](gog-docs-header.md) - List, create, or delete document headers
306+
- [gog docs header create](gog-docs-header-create.md) - Create and optionally populate a header
307+
- [gog docs header delete](gog-docs-header-delete.md) - Delete a header
308+
- [gog docs header list](gog-docs-header-list.md) - List headers and their segment IDs
301309
- [gog docs headings](gog-docs-headings.md) - List document headings
302310
- [gog docs headings list](gog-docs-headings-list.md) - List heading paragraphs
303311
- [gog docs images](gog-docs-images.md) - List document images
@@ -306,9 +314,12 @@ Generated pages: 682.
306314
- [gog docs insert](gog-docs-insert.md) - Insert text at a specific position
307315
- [gog docs insert-date-chip](gog-docs-insert-date-chip.md) - Insert a native date smart chip
308316
- [gog docs insert-file-chip](gog-docs-insert-file-chip.md) - Insert a native Drive file smart chip
317+
- [gog docs insert-footnote](gog-docs-insert-footnote.md) - Insert and populate a footnote
318+
- [gog docs insert-horizontal-rule](gog-docs-insert-horizontal-rule.md) - Insert a paragraph-border horizontal rule
309319
- [gog docs insert-image](gog-docs-insert-image.md) - Insert a public image URL or upload a local image into a Google Doc
310320
- [gog docs insert-page-break](gog-docs-insert-page-break.md) - Insert a page break at a specific position (or end-of-doc with --at-end)
311321
- [gog docs insert-person](gog-docs-insert-person.md) - Insert a native person smart chip
322+
- [gog docs insert-section-break](gog-docs-insert-section-break.md) - Insert a continuous or next-page section break
312323
- [gog docs insert-table](gog-docs-insert-table.md) - Insert a native table at a specific position (or end-of-doc with --at-end), optionally populated via --values-json
313324
- [gog docs list-tabs](gog-docs-list-tabs.md) - List all tabs in a Google Doc
314325
- [gog docs named-range](gog-docs-named-range.md) - Manage named ranges
@@ -322,6 +333,7 @@ Generated pages: 682.
322333
- [gog docs raw](gog-docs-raw.md) - Dump raw Google Docs API response as JSON (Documents.Get; lossless; for scripting and LLM consumption)
323334
- [gog docs rename-tab](gog-docs-rename-tab.md) - Rename a tab in a Google Doc
324335
- [gog docs replace-image](gog-docs-replace-image.md) - Replace an existing image without changing its position or bounds
336+
- [gog docs section-columns](gog-docs-section-columns.md) - Set the column count for a document section
325337
- [gog docs sed](gog-docs-sed.md) - Regex find/replace (sed-style: s/pattern/replacement/g)
326338
- [gog docs structure](gog-docs-structure.md) - Show document structure with numbered paragraphs
327339
- [gog docs table-column](gog-docs-table-column.md) - Insert or delete native table columns

docs/commands/gog-docs-delete.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ gog docs (doc) delete <docId> [flags]
3939
| `--occurrence` | `*int` | | Use the Nth --at match (1-based; required when --at is ambiguous) |
4040
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
4141
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
42+
| `--segment` | `string` | | Target an exact header, footer, or footnote segment ID |
4243
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
4344
| `--start` | `*int64` | | Start index (>= 1; required unless --at is set) |
4445
| `--tab` | `string` | | Target a specific tab by title or ID (see docs list-tabs) |

docs/commands/gog-docs-find-range.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ gog docs (doc) find-range <docId> <text> [flags]
3939
| `--occurrence` | `*int` | | Return the Nth occurrence (1-based; default first) |
4040
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
4141
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
42+
| `--segment` | `string` | | Target an exact header, footer, or footnote segment ID |
4243
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
4344
| `--tab` | `string` | | Target a specific tab by title or ID (see docs list-tabs) |
4445
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# `gog docs footer create`
2+
3+
> Generated from `gog schema --json`. Do not edit this page by hand; run `make docs-commands`.
4+
5+
Create and optionally populate a footer
6+
7+
## Usage
8+
9+
```bash
10+
gog docs (doc) footer (footers) create (add,new) <docId> [flags]
11+
```
12+
13+
## Parent
14+
15+
- [gog docs footer](gog-docs-footer.md)
16+
17+
## Flags
18+
19+
| Flag | Type | Default | Help |
20+
| --- | --- | --- | --- |
21+
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
22+
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email, alias, or auto for authenticated Google API commands |
23+
| `--at` | `string` | | Anchor by literal text and use the start of the matched range |
24+
| `--at-end` | `bool` | | Target end-of-doc/tab (mutually exclusive with --index and --at) |
25+
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
26+
| `--color` | `string` | auto | Color output: auto\|always\|never |
27+
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
28+
| `-n`<br>`--dry-run`<br>`--dryrun`<br>`--noop`<br>`--preview` | `bool` | | Do not make changes; print intended actions and exit successfully |
29+
| `--enable-commands` | `string` | | Comma-separated list of enabled command prefixes; dot paths allowed (restricts CLI) |
30+
| `--enable-commands-exact` | `string` | | Comma-separated list of exact enabled commands; dot paths allowed and parent commands do not enable children |
31+
| `--file` | `string` | | Read initial footer text from a file ('-' for stdin) |
32+
| `-y`<br>`--force`<br>`--assume-yes`<br>`--yes` | `bool` | | Skip confirmations for destructive commands |
33+
| `--gmail-no-send` | `bool` | false | Block Gmail send operations (agent safety) |
34+
| `-h`<br>`--help` | `kong.helpFlag` | | Show context-sensitive help. |
35+
| `--home` | `string` | | Override gogcli config/data/state/cache root (equivalent to GOG_HOME) |
36+
| `--index` | `*int64` | | Character index (1 = beginning); omit for end-of-doc |
37+
| `-j`<br>`--json`<br>`--machine` | `bool` | false | Output JSON to stdout (best for scripting) |
38+
| `--match-case` | `bool` | | Use case-sensitive --at matching |
39+
| `--no-input`<br>`--non-interactive`<br>`--noninteractive` | `bool` | | Never prompt; fail instead (useful for CI) |
40+
| `--occurrence` | `*int` | | Use the Nth --at match (1-based; required when --at is ambiguous) |
41+
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
42+
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
43+
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
44+
| `--tab` | `string` | | Target a specific tab by title or ID (see docs list-tabs) |
45+
| `--text` | `string` | | Initial footer text |
46+
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
47+
| `--version` | `kong.VersionFlag` | | Print version and exit |
48+
| `--wrap-untrusted` | `bool` | false | In JSON/raw output, wrap fetched text fields in external untrusted-content markers |
49+
50+
## See Also
51+
52+
- [gog docs footer](gog-docs-footer.md)
53+
- [Command index](README.md)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# `gog docs footer delete`
2+
3+
> Generated from `gog schema --json`. Do not edit this page by hand; run `make docs-commands`.
4+
5+
Delete a footer
6+
7+
## Usage
8+
9+
```bash
10+
gog docs (doc) footer (footers) delete (rm,remove,del) <docId> <footerId> [flags]
11+
```
12+
13+
## Parent
14+
15+
- [gog docs footer](gog-docs-footer.md)
16+
17+
## Flags
18+
19+
| Flag | Type | Default | Help |
20+
| --- | --- | --- | --- |
21+
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
22+
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email, alias, or auto for authenticated Google API commands |
23+
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
24+
| `--color` | `string` | auto | Color output: auto\|always\|never |
25+
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
26+
| `-n`<br>`--dry-run`<br>`--dryrun`<br>`--noop`<br>`--preview` | `bool` | | Do not make changes; print intended actions and exit successfully |
27+
| `--enable-commands` | `string` | | Comma-separated list of enabled command prefixes; dot paths allowed (restricts CLI) |
28+
| `--enable-commands-exact` | `string` | | Comma-separated list of exact enabled commands; dot paths allowed and parent commands do not enable children |
29+
| `-y`<br>`--force`<br>`--assume-yes`<br>`--yes` | `bool` | | Skip confirmations for destructive commands |
30+
| `--gmail-no-send` | `bool` | false | Block Gmail send operations (agent safety) |
31+
| `-h`<br>`--help` | `kong.helpFlag` | | Show context-sensitive help. |
32+
| `--home` | `string` | | Override gogcli config/data/state/cache root (equivalent to GOG_HOME) |
33+
| `-j`<br>`--json`<br>`--machine` | `bool` | false | Output JSON to stdout (best for scripting) |
34+
| `--no-input`<br>`--non-interactive`<br>`--noninteractive` | `bool` | | Never prompt; fail instead (useful for CI) |
35+
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
36+
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
37+
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
38+
| `--tab` | `string` | | Tab title or ID containing the footer |
39+
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
40+
| `--version` | `kong.VersionFlag` | | Print version and exit |
41+
| `--wrap-untrusted` | `bool` | false | In JSON/raw output, wrap fetched text fields in external untrusted-content markers |
42+
43+
## See Also
44+
45+
- [gog docs footer](gog-docs-footer.md)
46+
- [Command index](README.md)
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# `gog docs footer list`
2+
3+
> Generated from `gog schema --json`. Do not edit this page by hand; run `make docs-commands`.
4+
5+
List footers and their segment IDs
6+
7+
## Usage
8+
9+
```bash
10+
gog docs (doc) footer (footers) list (ls) <docId> [flags]
11+
```
12+
13+
## Parent
14+
15+
- [gog docs footer](gog-docs-footer.md)
16+
17+
## Flags
18+
19+
| Flag | Type | Default | Help |
20+
| --- | --- | --- | --- |
21+
| `--access-token` | `string` | | Use provided access token directly (bypasses stored refresh tokens; token expires in ~1h) |
22+
| `-a`<br>`--account`<br>`--acct` | `string` | | Account email, alias, or auto for authenticated Google API commands |
23+
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
24+
| `--color` | `string` | auto | Color output: auto\|always\|never |
25+
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
26+
| `-n`<br>`--dry-run`<br>`--dryrun`<br>`--noop`<br>`--preview` | `bool` | | Do not make changes; print intended actions and exit successfully |
27+
| `--enable-commands` | `string` | | Comma-separated list of enabled command prefixes; dot paths allowed (restricts CLI) |
28+
| `--enable-commands-exact` | `string` | | Comma-separated list of exact enabled commands; dot paths allowed and parent commands do not enable children |
29+
| `-y`<br>`--force`<br>`--assume-yes`<br>`--yes` | `bool` | | Skip confirmations for destructive commands |
30+
| `--gmail-no-send` | `bool` | false | Block Gmail send operations (agent safety) |
31+
| `-h`<br>`--help` | `kong.helpFlag` | | Show context-sensitive help. |
32+
| `--home` | `string` | | Override gogcli config/data/state/cache root (equivalent to GOG_HOME) |
33+
| `-j`<br>`--json`<br>`--machine` | `bool` | false | Output JSON to stdout (best for scripting) |
34+
| `--no-input`<br>`--non-interactive`<br>`--noninteractive` | `bool` | | Never prompt; fail instead (useful for CI) |
35+
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
36+
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
37+
| `--select`<br>`--pick`<br>`--project` | `string` | | In JSON mode, select comma-separated fields (best-effort; supports dot paths). Desire path: use --fields for most commands. |
38+
| `--tab` | `string` | | Limit results to a tab title or ID |
39+
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
40+
| `--version` | `kong.VersionFlag` | | Print version and exit |
41+
| `--wrap-untrusted` | `bool` | false | In JSON/raw output, wrap fetched text fields in external untrusted-content markers |
42+
43+
## See Also
44+
45+
- [gog docs footer](gog-docs-footer.md)
46+
- [Command index](README.md)

0 commit comments

Comments
 (0)