feat: add machine-friendly output modes to token create#786
Open
inickt wants to merge 1 commit intolivekit:mainfrom
Open
feat: add machine-friendly output modes to token create#786inickt wants to merge 1 commit intolivekit:mainfrom
inickt wants to merge 1 commit intolivekit:mainfrom
Conversation
rektdeckard
reviewed
Mar 9, 2026
Member
rektdeckard
left a comment
There was a problem hiding this comment.
Just a few comments, but overall idea is sound!
Comment on lines
+66
to
+67
| jsonFlag, | ||
| tokenOnlyFlag, |
Member
There was a problem hiding this comment.
Please use MutuallyExclusiveFlags for these rather than implementing the check yourself
| participant = util.ExpandTemplate("participant-%x") | ||
| fmt.Printf("Using generated participant identity [%s]\n", util.Accented(participant)) | ||
| if outputMode == tokenOutputModeHuman { | ||
| fmt.Printf("Using generated participant identity [%s]\n", util.Accented(participant)) |
Member
There was a problem hiding this comment.
While you're here, let's print things like this to stdErr as well.
| room = util.ExpandTemplate("room-%t") | ||
| fmt.Printf("Using generated room name [%s]\n", util.Accented(room)) | ||
| if outputMode == tokenOutputModeHuman { | ||
| fmt.Printf("Using generated room name [%s]\n", util.Accented(room)) |
| if dur, err := time.ParseDuration(validFor); err == nil { | ||
| fmt.Println("valid for (mins): ", int(dur/time.Minute)) | ||
| if outputMode == tokenOutputModeHuman { | ||
| fmt.Println("valid for (mins): ", int(dur/time.Minute)) |
Member
There was a problem hiding this comment.
Note to self: our homebrew formula currently has a smoketest that checks stdOut for several commands; this will need to be updated in next release.
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.
Adds scripting-friendly output modes to token generation:
--jsonand--token-onlyfor bothlk token createand deprecatedlk create-token--jsonwith--token-only)Example:
lk token create --list --json | jq -r '.access_token'(also needs #785)Other options would be:
lk token createcommand to send more information to stderr instead, so the--token-onlyflag isn't needed.I thought those were more involved changes so opted for this