chore: remove database import from cli (#13756)

Cli was using a utility function from a database package.
This commit is contained in:
Steven Masley
2024-07-01 11:58:23 -10:00
committed by GitHub
parent b1ec4630f2
commit abc0ff9689

View File

@ -29,7 +29,6 @@ import (
"golang.org/x/mod/semver" "golang.org/x/mod/semver"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/coder/coder/v2/coderd/database/db2sdk"
"github.com/coder/pretty" "github.com/coder/pretty"
"github.com/coder/coder/v2/buildinfo" "github.com/coder/coder/v2/buildinfo"
@ -659,9 +658,10 @@ func (o *OrganizationContext) Selected(inv *serpent.Invocation, client *codersdk
}) })
if index < 0 { if index < 0 {
names := db2sdk.List(orgs, func(f codersdk.Organization) string { var names []string
return f.Name for _, org := range orgs {
}) names = append(names, org.Name)
}
return codersdk.Organization{}, xerrors.Errorf("organization %q not found, are you sure you are a member of this organization? "+ return codersdk.Organization{}, xerrors.Errorf("organization %q not found, are you sure you are a member of this organization? "+
"Valid options for '--org=' are [%s].", o.FlagSelect, strings.Join(names, ", ")) "Valid options for '--org=' are [%s].", o.FlagSelect, strings.Join(names, ", "))
} }