2020-12-07 06:02:50 +08:00
|
|
|
// Copyright 2020 The Gitea Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a MIT-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
package print
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"code.gitea.io/sdk/gitea"
|
|
|
|
)
|
|
|
|
|
2021-09-29 04:32:16 +08:00
|
|
|
// OrganizationDetails prints details of an org with formatting
|
|
|
|
func OrganizationDetails(org *gitea.Organization) {
|
|
|
|
outputMarkdown(fmt.Sprintf(
|
|
|
|
"# %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-07 06:02:50 +08:00
|
|
|
// OrganizationsList prints a listing of the organizations
|
2020-12-08 18:28:54 +08:00
|
|
|
func OrganizationsList(organizations []*gitea.Organization, output string) {
|
2020-12-07 06:02:50 +08:00
|
|
|
if len(organizations) == 0 {
|
|
|
|
fmt.Println("No organizations found")
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-12-10 06:04:36 +08:00
|
|
|
t := tableWithHeader(
|
2020-12-07 06:02:50 +08:00
|
|
|
"Name",
|
|
|
|
"FullName",
|
|
|
|
"Website",
|
|
|
|
"Location",
|
|
|
|
"Description",
|
2020-12-10 06:04:36 +08:00
|
|
|
)
|
2020-12-07 06:02:50 +08:00
|
|
|
|
|
|
|
for _, org := range organizations {
|
2020-12-10 06:04:36 +08:00
|
|
|
t.addRow(
|
|
|
|
org.UserName,
|
|
|
|
org.FullName,
|
|
|
|
org.Website,
|
|
|
|
org.Location,
|
|
|
|
org.Description,
|
2020-12-07 06:02:50 +08:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-12-10 06:04:36 +08:00
|
|
|
t.print(output)
|
2020-12-07 06:02:50 +08:00
|
|
|
}
|