refactor(cli): deprecate --tab-id in favor of --tab#533
Closed
johnbenjaminlewis wants to merge 1 commit intoopenclaw:mainfrom
Closed
refactor(cli): deprecate --tab-id in favor of --tab#533johnbenjaminlewis wants to merge 1 commit intoopenclaw:mainfrom
johnbenjaminlewis wants to merge 1 commit intoopenclaw:mainfrom
Conversation
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.
e5f3135 to
50e6936
Compare
| // 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) { |
Contributor
Author
There was a problem hiding this comment.
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 { |
Contributor
Author
There was a problem hiding this comment.
func findTab which duplicates this logic
Collaborator
|
Thanks @johnbenjaminlewis. Landed on main as 50f506d, with a maintainer follow-up in 617293d. What changed before landing:
Verified:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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).--tab-idto--tabon all 5 editing commands, accepting both tab titles (case-insensitive) and tab IDs--tab-idas a hidden flag that still works but emits a deprecation warning to stderr--taband--tab-idsimultaneously with a clear errordocsTargetEndIndex,loadDocsTargetDocument) from the ID-onlyfindTabByIDto the title-awarefindTab, so title resolution actually works for mutations — not just readsfindTabByIDTest plan
--taband still passTestDocsWriteCmd_DeprecatedTabIDFlagverifies--tab-idstill works and emits the deprecation warning--tabindocs update --helpoutputmake testpasses