feat(get): add default-org to fetch user default organization#979
Merged
Conversation
Adds `kosli get default-org` which calls `GET /api/v2/user/default-org` to retrieve the default organization for the currently authenticated user. Supports table (default) and json output.
Contributor
|
Claude finished @mbevc1's task in 1m 53s —— View job Review:
|
| Check | Result |
|---|---|
go build ./... |
✅ passes |
go vet ./cmd/kosli/ |
✅ clean |
go mod tidy (diff check) |
✅ no changes |
Summary
This is a clean, well-scoped slice that follows the repo's established conventions closely. 👍
Strengths
newGetDefaultOrgCmdmirrors the existingnew<Command>Cmd()factory pattern, usesRequireGlobalFlagsinPreRunE, and wiresoutput.FormattedPrintwithtable/jsonformatters exactly like siblinggetcommands.- The empty-org
(none set)fallback (the suggestion from my earlier review) was incorporated, and it's backed by a dedicated unit test (TestPrintDefaultOrgAsTableNoneSet) — nice closure on that thread. - Good test coverage for a slice this size: pure unit tests for the table renderer plus an
httpfake-driven suite test covering table output,--output json, and theNoArgserror path. - The
updateDefaultOrgLongDescwording fix improves consistency with the newgetcommand's description.
Minor / optional observations (none blocking)
Args: cobra.NoArgsis correct here, and the test asserting the error onextra-argis a nice touch.- The
defaultOrgstruct +json.Unmarshalerror is propagated correctly; if the API ever returns a non-200 with an error body,kosliClient.Doalready surfaces that, so no extra handling is needed. - No dry-run flag on this
getcommand — correct, since it's a read-onlyGET(consistent with othergetsubcommands).
Nothing required from my side — looks ready to merge. ✅
· 20260629_get_default-org
…n-set default org
ToreMerkely
approved these changes
Jun 29, 2026
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
kosli get default-orgwhich callsGET /api/v2/user/default-orgto retrieve the default organization for the currently authenticated user. Supports table (default) and json output.