feat: Add default retrieve handler when passing an id to commands#345
Merged
blainekasten merged 1 commit intonextfrom Apr 28, 2026
Merged
feat: Add default retrieve handler when passing an id to commands#345blainekasten merged 1 commit intonextfrom
blainekasten merged 1 commit intonextfrom
Conversation
435289d to
19c7801
Compare
7c8274e to
67a6943
Compare
zainhas
approved these changes
Apr 28, 2026
| first = toks[0] if toks else "" | ||
| if re_identifier.match(first): | ||
| toks.insert(0, "retrieve") | ||
| command, bound, _unused, _ignored = app.parse_known_args(toks) |
Collaborator
There was a problem hiding this comment.
what happens here if someone types tg files random_stuff or just tg files with no args?
first won't match the regex, we don't insert retrieve, and then we re-call parse_known_args on the same tokens, doesn't that route back into this same default handler?
in that case I feel like a nice DX thing would be to insert tg files list and get a full table of all previous files
Contributor
Author
There was a problem hiding this comment.
So no, we are passing the "sub app" here, not the top level app. So the top level meta handler gets called only once.
fddcf75 to
506323b
Compare
506323b to
638e436
Compare
Open
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.
This enables a short hand
retrieveby matching theidstyle as a heurestic to assume retrieve.E.g., the following is now possible and shows the related command:
tg files file-xxxtg files retrieve file-xxxtg evals eval-xxxxx-xxxtg evals retrieve eval-xxxxx-xxxetc...