Skip to content

Commit 197992a

Browse files
committed
feat(docs): add find-range command
1 parent cfddf88 commit 197992a

8 files changed

Lines changed: 623 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
### Added
66

77
- Chat: add repeatable `--attach` to `chat messages send` for sending local files with Google Chat messages. (#694) — thanks @omothm.
8+
- Docs: add `docs find-range` to map matched text to Docs API UTF-16 index ranges. (#682) — thanks @sebsnyk.
89
- Docs: add `--link` and `--no-link` to `docs format` for setting or clearing hyperlinks on matched text. (#684) — thanks @sebsnyk.
910
- Slides: add `slides insert-image` to place a positioned, sized local image on an existing slide. (#695) — thanks @Czaruno.
1011

docs/commands.generated.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,7 @@ Generated from `gog schema --json`.
237237
- [`gog docs (doc) delete-tab <docId> [flags]`](commands/gog-docs-delete-tab.md) - Delete a tab from a Google Doc
238238
- [`gog docs (doc) edit <docId> <find> <replace> [flags]`](commands/gog-docs-edit.md) - Find and replace text in a Google Doc
239239
- [`gog docs (doc) export (download,dl) <docId> [flags]`](commands/gog-docs-export.md) - Export a Google Doc (pdf|docx|txt|md|html)
240+
- [`gog docs (doc) find-range <docId> <text> [flags]`](commands/gog-docs-find-range.md) - Find text and print Docs API UTF-16 index ranges
240241
- [`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.
241242
- [`gog docs (doc) format <docId> [flags]`](commands/gog-docs-format.md) - Apply text or paragraph formatting to a Google Doc
242243
- [`gog docs (doc) info (get,show) <docId>`](commands/gog-docs-info.md) - Get Google Doc metadata

docs/commands/README.md

Lines changed: 2 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: 584.
5+
Generated pages: 585.
66

77
## Top-level Commands
88

@@ -289,6 +289,7 @@ Generated pages: 584.
289289
- [gog docs delete-tab](gog-docs-delete-tab.md) - Delete a tab from a Google Doc
290290
- [gog docs edit](gog-docs-edit.md) - Find and replace text in a Google Doc
291291
- [gog docs export](gog-docs-export.md) - Export a Google Doc (pdf|docx|txt|md|html)
292+
- [gog docs find-range](gog-docs-find-range.md) - Find text and print Docs API UTF-16 index ranges
292293
- [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.
293294
- [gog docs format](gog-docs-format.md) - Apply text or paragraph formatting to a Google Doc
294295
- [gog docs info](gog-docs-info.md) - Get Google Doc metadata
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# `gog docs find-range`
2+
3+
> Generated from `gog schema --json`. Do not edit this page by hand; run `make docs-commands`.
4+
5+
Find text and print Docs API UTF-16 index ranges
6+
7+
## Usage
8+
9+
```bash
10+
gog docs (doc) find-range <docId> <text> [flags]
11+
```
12+
13+
## Parent
14+
15+
- [gog docs](gog-docs.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 for API commands (gmail/calendar/chat/classroom/drive/drivelabels/docs/slides/contacts/tasks/people/sheets/forms/sites/appscript/analytics/searchconsole/youtube/photos) |
23+
| `--all` | `bool` | | Return all matches |
24+
| `--client` | `string` | | OAuth client name (selects stored credentials + token bucket) |
25+
| `--color` | `string` | auto | Color output: auto\|always\|never |
26+
| `--disable-commands` | `string` | | Comma-separated list of disabled commands; dot paths allowed |
27+
| `-n`<br>`--dry-run`<br>`--dryrun`<br>`--noop`<br>`--preview` | `bool` | | Do not make changes; print intended actions and exit successfully |
28+
| `--enable-commands` | `string` | | Comma-separated list of enabled command prefixes; dot paths allowed (restricts CLI) |
29+
| `--enable-commands-exact` | `string` | | Comma-separated list of exact enabled commands; dot paths allowed and parent commands do not enable children |
30+
| `--fail-empty`<br>`--non-empty`<br>`--require-results` | `bool` | | Exit with code 3 if no matches |
31+
| `-y`<br>`--force`<br>`--assume-yes`<br>`--yes` | `bool` | | Skip confirmations for destructive commands |
32+
| `--gmail-no-send` | `bool` | false | Block Gmail send operations (agent safety) |
33+
| `-h`<br>`--help` | `kong.helpFlag` | | Show context-sensitive help. |
34+
| `--home` | `string` | | Override gogcli config/data/state/cache root (equivalent to GOG_HOME) |
35+
| `-j`<br>`--json`<br>`--machine` | `bool` | false | Output JSON to stdout (best for scripting) |
36+
| `--match-case` | `bool` | | Use case-sensitive matching |
37+
| `--no-input`<br>`--non-interactive`<br>`--noninteractive` | `bool` | | Never prompt; fail instead (useful for CI) |
38+
| `--normalize-whitespace` | `bool` | true | Collapse whitespace while matching |
39+
| `--occurrence` | `*int` | | Return the Nth occurrence (1-based; default first) |
40+
| `-p`<br>`--plain`<br>`--tsv` | `bool` | false | Output stable, parseable text to stdout (TSV; no colors) |
41+
| `--results-only` | `bool` | | In JSON mode, emit only the primary result (drops envelope fields like nextPageToken) |
42+
| `--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. |
43+
| `--tab` | `string` | | Target a specific tab by title or ID (see docs list-tabs) |
44+
| `-v`<br>`--verbose` | `bool` | | Enable verbose logging |
45+
| `--version` | `kong.VersionFlag` | | Print version and exit |
46+
| `--wrap-untrusted` | `bool` | false | In JSON/raw output, wrap fetched text fields in external untrusted-content markers |
47+
48+
## See Also
49+
50+
- [gog docs](gog-docs.md)
51+
- [Command index](README.md)

docs/commands/gog-docs.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ gog docs (doc) <command> [flags]
2828
- [gog docs delete-tab](gog-docs-delete-tab.md) - Delete a tab from a Google Doc
2929
- [gog docs edit](gog-docs-edit.md) - Find and replace text in a Google Doc
3030
- [gog docs export](gog-docs-export.md) - Export a Google Doc (pdf|docx|txt|md|html)
31+
- [gog docs find-range](gog-docs-find-range.md) - Find text and print Docs API UTF-16 index ranges
3132
- [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.
3233
- [gog docs format](gog-docs-format.md) - Apply text or paragraph formatting to a Google Doc
3334
- [gog docs info](gog-docs-info.md) - Get Google Doc metadata

internal/cmd/docs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ type DocsCmd struct {
4141
InsertDateChip DocsInsertDateChipCmd `cmd:"" name:"insert-date-chip" help:"Insert a native date smart chip"`
4242
InsertPageBreak DocsInsertPageBreakCmd `cmd:"" name:"insert-page-break" aliases:"page-break,pb" help:"Insert a page break at a specific position (or end-of-doc with --at-end)"`
4343
Delete DocsDeleteCmd `cmd:"" name:"delete" help:"Delete text range from document"`
44+
FindRange DocsFindRangeCmd `cmd:"" name:"find-range" help:"Find text and print Docs API UTF-16 index ranges"`
4445
FindReplace DocsFindReplaceCmd `cmd:"" name:"find-replace" help:"Find and replace text. Supports plain text or markdown with images; use --first for a single occurrence."`
4546
Update DocsUpdateCmd `cmd:"" name:"update" help:"Insert or replace text at a specific index or range in a Google Doc"`
4647
Edit DocsEditCmd `cmd:"" name:"edit" help:"Find and replace text in a Google Doc"`

0 commit comments

Comments
 (0)