mirror of
				https://gitea.com/gitea/tea.git
				synced 2025-10-31 09:15:26 +01:00 
			
		
		
		
	Refactor: Move list print functions into print package (#273)
MV list issues -> print.IssuesList MV list labels -> print.LabelsList & task.LabelsExport MV list logins -> print.LoginsList MV list miles -> print.MilestonesList MV list pulls -> print.PullsList MV list releases -> print.ReleasesList MV list issues&pulls of mile -> print.IssuesPullsList MV list notification threads -> print.NotificationsList Unexport print.outputList Unexport print.outputMarkdown remove comd/flags dependency in print module Reviewed-on: https://gitea.com/gitea/tea/pulls/273 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com> Reviewed-by: Andrew Thornton <art27@cantab.net> Co-Authored-By: 6543 <6543@obermui.de> Co-Committed-By: 6543 <6543@obermui.de>
This commit is contained in:
		| @@ -6,7 +6,6 @@ package cmd | ||||
|  | ||||
| import ( | ||||
| 	"log" | ||||
| 	"strings" | ||||
|  | ||||
| 	"code.gitea.io/tea/cmd/flags" | ||||
| 	"code.gitea.io/tea/modules/config" | ||||
| @@ -78,41 +77,6 @@ func runNotifications(ctx *cli.Context) error { | ||||
| 		log.Fatal(err) | ||||
| 	} | ||||
|  | ||||
| 	headers := []string{ | ||||
| 		"Type", | ||||
| 		"Index", | ||||
| 		"Title", | ||||
| 	} | ||||
| 	if ctx.Bool("all") { | ||||
| 		headers = append(headers, "Repository") | ||||
| 	} | ||||
|  | ||||
| 	var values [][]string | ||||
|  | ||||
| 	for _, n := range news { | ||||
| 		if n.Subject == nil { | ||||
| 			continue | ||||
| 		} | ||||
| 		// if pull or Issue get Index | ||||
| 		var index string | ||||
| 		if n.Subject.Type == "Issue" || n.Subject.Type == "Pull" { | ||||
| 			index = n.Subject.URL | ||||
| 			urlParts := strings.Split(n.Subject.URL, "/") | ||||
| 			if len(urlParts) != 0 { | ||||
| 				index = urlParts[len(urlParts)-1] | ||||
| 			} | ||||
| 			index = "#" + index | ||||
| 		} | ||||
|  | ||||
| 		item := []string{n.Subject.Type, index, n.Subject.Title} | ||||
| 		if ctx.Bool("all") { | ||||
| 			item = append(item, n.Repository.FullName) | ||||
| 		} | ||||
| 		values = append(values, item) | ||||
| 	} | ||||
|  | ||||
| 	if len(values) != 0 { | ||||
| 		print.OutputList(flags.GlobalOutputValue, headers, values) | ||||
| 	} | ||||
| 	print.NotificationsList(news, flags.GlobalOutputValue, ctx.Bool("all")) | ||||
| 	return nil | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 6543
					6543