-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: use SDK metadata #378
Conversation
1572817
to
066e639
Compare
066e639
to
c18a0a6
Compare
The majority of the changes are |
selectedIndex int | ||
selectedSDK sdkDetail | ||
} | ||
|
||
func NewChooseSDKModel(selectedIndex int) tea.Model { | ||
initSDKs() | ||
l := list.New(sdksToItems(), sdkDelegate{}, 30, 9) | ||
sdkDetails := initSDKs() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the PR to not use the global var but pass this list around instead. It felt weird to modify it when we could encapsulate it in the model.
} | ||
index := slices.Index(sdkOrder, id) | ||
if index == -1 { | ||
// if we missed an SDK don't add it with an invalid index |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without this, there's a panic since it would later try to reference a -1 index. It shouldn't happen unless we change the SDK ID and forget to update the order list.
The CLI currently hard-codes certain information about LaunchDarkly SDKs, including example links, display names, and SDK types (server, client, and so on.)
This information must be manually kept up-to-date by the CLI maintainers or SDK engineers.
With the introduction of the
sdk-meta
Go module, we're able to source this metadata externally.As background, whenever a LaunchDarkly SDK's metadata is updated (example), the sdk-meta project crawls the changes and generates a new Go module version.
In this PR, I've removed data that is now provided by the sdk-meta module. SDK example links are not yet part of the sdk-meta project, so I transformed those into a simple lookup table.
Finally, I renamed the SDK quickstart instruction files. To retrieve metadata for a particular SDK, you need the SDK's ID. It makes sense to define this as part of the filename.
The effect is that if you add a new quickstart instruction with a particular SDK ID, metadata will be automatically found for it.