mirror of
https://github.com/hanzoai/runtime.git
synced 2026-10-30 18:23:13 +00:00
- Add main Dockerfile for production builds - Add Dockerfile.runtime for secure code execution - Add Dockerfile.runtime.fixed with improved configuration - Include .dockerignore for build optimization - Add integration documentation and publishing guides - Update API and CLI components for better runtime support - Enhance sandbox and container management features
43 lines
1010 B
Go
43 lines
1010 B
Go
// Copyright 2025 Hanzo Industries Inc.
|
|
// SPDX-License-Identifier: AGPL-3.0
|
|
|
|
package organization
|
|
|
|
import (
|
|
"github.com/charmbracelet/huh"
|
|
"github.com/hanzoai/apiclient"
|
|
"github.com/hanzoai/runtime/cli/views/common"
|
|
)
|
|
|
|
func GetOrganizationIdFromPrompt(organizationList []apiclient.Organization) (*apiclient.Organization, error) {
|
|
var chosenOrganizationId string
|
|
var organizationOptions []huh.Option[string]
|
|
|
|
for _, organization := range organizationList {
|
|
organizationOptions = append(organizationOptions, huh.NewOption(organization.Name, organization.Id))
|
|
}
|
|
|
|
form := huh.NewForm(
|
|
huh.NewGroup(
|
|
huh.NewSelect[string]().
|
|
Title("Choose an Organization").
|
|
Options(
|
|
organizationOptions...,
|
|
).
|
|
Value(&chosenOrganizationId),
|
|
).WithTheme(common.GetCustomTheme()),
|
|
)
|
|
|
|
if err := form.Run(); err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
for _, organization := range organizationList {
|
|
if organization.Id == chosenOrganizationId {
|
|
return &organization, nil
|
|
}
|
|
}
|
|
|
|
return nil, nil
|
|
}
|