Add experimental --tab flag to `gog docs export` and `gog drive download`
that exports a single tab from a Google Doc by title or ID. Uses the
undocumented per-tab Docs export endpoint with a custom redirect policy
that rejects non-Google redirects to detect auth failures early.
(cherry picked from commit 5a741be7ce0df13f75a10bc7a70df9fbab9475da)
Thin wrappers around presentations.batchUpdate for surgical text edits on
an existing deck.
- insert-text inserts text into a page element by objectId, with
--insertion-index, --replace (emits DeleteText+InsertText), and
stdin support via '-'.
- replace-text runs ReplaceAllText across the deck, with --match-case
and repeatable --page for slide-scoped replacements.
Both honor the global --dry-run (prints the batchUpdate request body as
JSON without calling the API) and --json (emits the full
BatchUpdatePresentationResponse). Plain output gives a one-line
confirmation with revisionId + replies/replaced count. Style mirrors
existing update-notes and replace-slide commands.
Supports "text" (default, existing behavior) and "html" to prefer
the HTML MIME part over plaintext. Useful for newsletter ingestion
where the HTML body contains the rich formatted content.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
(cherry picked from commit cb5499ed7b4d20a863de1aef07c58c94ecd9a9fe)
Users had no CLI-native way to scope a Drive search to a specific
shared drive or folder. Workarounds required either raw query syntax
(which only matches direct children) or direct API calls bypassing
gog entirely, defeating the purpose of the CLI.
This adds two new flags to 'drive search':
--drive <driveId> Scopes search to a specific shared drive using
corpora=drive&driveId=X. This is the Drive API's
proper pattern for within-drive recursive search.
Mutually exclusive with --no-all-drives.
--parent <folderId> Wraps the query with "'<folderId>' in parents"
to scope results to direct children of a folder
(matching 'drive ls --parent' semantics).
Mutually exclusive with --raw-query (users with
raw queries can include the clause themselves).
Implementation:
* driveFilesListCallWithDriveSupport takes a new driveID argument;
when non-empty it sets Corpora("drive").DriveId(X), overriding
the generic Corpora("allDrives") path.
* driveFileListOptions gains a driveID field.
* DriveSearchCmd validates flag combinations up front.
Behavior change:
* No-args search behavior unchanged — existing users see no change.
* The sole caller of driveFilesListCallWithDriveSupport passes the
new driveID from options, preserving current corpora=allDrives
behavior by default.
Tests added:
* TestDriveSearchCmd_WithDrive — verifies corpora=drive+driveId wire
* TestDriveSearchCmd_WithParent — verifies query clause injection
* TestDriveSearchCmd_DriveAndParent_Combine — verifies the common
combo of scoping by shared drive + folder works together
* TestDriveSearchCmd_DriveAndNoAllDrives_Conflicts
* TestDriveSearchCmd_ParentAndRawQuery_Conflicts
(cherry picked from commit 581fbc9fc23a1f78d0773c6897ca84bdeb77dabc)
Rename the --tab-id flag to --tab on all docs editing commands (write,
update, insert, delete, find-replace) to match the convention already
used by cat, structure, sed, and the new export command. The old
--tab-id flag is preserved as a hidden alias that emits a deprecation
warning to stderr.
Also switches the internal helpers (docsTargetEndIndex,
loadDocsTargetDocument) from findTabByID to findTab so that --tab
resolves by title as well as ID. Removes the now-unused findTabByID.
(cherry picked from commit 50e69365539483b8b17f697d1391656b324a67af)