Skip to content

refactor(cli): deprecate --tab-id in favor of --tab#533

Closed
johnbenjaminlewis wants to merge 1 commit intoopenclaw:mainfrom
johnbenjaminlewis:refactor/tab-id-to-tab-deprecation
Closed

refactor(cli): deprecate --tab-id in favor of --tab#533
johnbenjaminlewis wants to merge 1 commit intoopenclaw:mainfrom
johnbenjaminlewis:refactor/tab-id-to-tab-deprecation

Conversation

@johnbenjaminlewis
Copy link
Copy Markdown
Contributor

Summary

The docs editing commands (write, update, insert, delete, find-replace) used --tab-id (ID only), while the read commands (cat, structure, sed) already used --tab (title or ID).

  • Renames --tab-id to --tab on all 5 editing commands, accepting both tab titles (case-insensitive) and tab IDs
  • Keeps --tab-id as a hidden flag that still works but emits a deprecation warning to stderr
  • Rejects passing both --tab and --tab-id simultaneously with a clear error
  • Switches internal helpers (docsTargetEndIndex, loadDocsTargetDocument) from the ID-only findTabByID to the title-aware findTab, so title resolution actually works for mutations — not just reads
  • Removes the now-unused findTabByID

Test plan

  • Existing tab editing tests updated to use --tab and still pass
  • New TestDocsWriteCmd_DeprecatedTabIDFlag verifies --tab-id still works and emits the deprecation warning
  • Help snapshot test updated to check for --tab in docs update --help output
  • make test passes

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.
@johnbenjaminlewis johnbenjaminlewis force-pushed the refactor/tab-id-to-tab-deprecation branch from e5f3135 to 50e6936 Compare April 27, 2026 01:38
Comment thread internal/cmd/docs_edit.go
// resolveTabArg returns the effective tab value from --tab or the deprecated
// --tab-id flag. It rejects supplying both and emits a deprecation warning
// when --tab-id is used.
func resolveTabArg(ctx context.Context, tab, tabID string) (string, error) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function + its [five] call sites are the logical changes of this PR. The rest of the changes are

  • s/c.TabID/c.Tab/
  • s/--tab-id/--tab/
  • s/findTabByID/findTab/
  • and removing the unused findTabByID

return end
}

func findTabByID(tabs []*docs.Tab, tabID string) *docs.Tab {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

func findTab which duplicates this logic

@steipete
Copy link
Copy Markdown
Collaborator

Thanks @johnbenjaminlewis. Landed on main as 50f506d, with a maintainer follow-up in 617293d.

What changed before landing:

  • kept the hidden deprecated --tab-id alias and the --tab spelling
  • fixed the mutation path so tab titles resolve to the canonical Docs tab ID before batchUpdate requests
  • added/updated regression coverage for write/update/insert/delete/find-replace with --tab titles

Verified:

  • go test ./internal/cmd focused docs/drive suite
  • make ci
  • live smoke on steipete@gmail.com: created a temp Doc, resolved "Tab 1" via --tab, wrote content, read it back, and trashed the doc

@steipete steipete closed this Apr 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants