2020-12-06 23:02:50 +01:00
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
2023-09-08 03:40:02 +02:00
|
|
|
// SPDX-License-Identifier: MIT
|
2020-12-06 23:02:50 +01:00
|
|
|
|
|
|
|
package print
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"code.gitea.io/sdk/gitea"
|
|
|
|
)
|
|
|
|
|
2021-09-28 22:32:16 +02:00
|
|
|
// OrganizationDetails prints details of an org with formatting
|
|
|
|
func OrganizationDetails(org *gitea.Organization) {
|
2023-04-30 05:43:26 +02:00
|
|
|
_ = outputMarkdown(fmt.Sprintf(
|
2021-09-28 22:32:16 +02:00
|
|
|
"# %s\n%s\n\n- Visibility: %s\n- Location: %s\n- Website: %s\n",
|
|
|
|
org.UserName,
|
|
|
|
org.Description,
|
|
|
|
org.Visibility,
|
|
|
|
org.Location,
|
|
|
|
org.Website,
|
|
|
|
), "")
|
|
|
|
}
|
|
|
|
|
2020-12-06 23:02:50 +01:00
|
|
|
// OrganizationsList prints a listing of the organizations
|
2020-12-08 11:28:54 +01:00
|
|
|
func OrganizationsList(organizations []*gitea.Organization, output string) {
|
2020-12-06 23:02:50 +01:00
|
|
|
if len(organizations) == 0 {
|
|
|
|
fmt.Println("No organizations found")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-12-09 23:04:36 +01:00
|
|
|
t := tableWithHeader(
|
2020-12-06 23:02:50 +01:00
|
|
|
"Name",
|
|
|
|
"FullName",
|
|
|
|
"Website",
|
|
|
|
"Location",
|
|
|
|
"Description",
|
2020-12-09 23:04:36 +01:00
|
|
|
)
|
2020-12-06 23:02:50 +01:00
|
|
|
|
|
|
|
for _, org := range organizations {
|
2020-12-09 23:04:36 +01:00
|
|
|
t.addRow(
|
|
|
|
org.UserName,
|
|
|
|
org.FullName,
|
|
|
|
org.Website,
|
|
|
|
org.Location,
|
|
|
|
org.Description,
|
2020-12-06 23:02:50 +01:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-12-09 23:04:36 +01:00
|
|
|
t.print(output)
|
2020-12-06 23:02:50 +01:00
|
|
|
}
|