mirror of
https://gitea.com/gitea/tea.git
synced 2025-09-02 09:58:29 +02:00
Add Repo Create subcomand & enhancements (#173)
repos ls: use owner filter and remove org&user one better desc refactor rm local filter, let us fix upstream split user org add archive and private filters use SearchRepos migrate to sdk v0.13.0 print URL add CmdRepoCreate, Add RepoDetails ListRepos: better desc, add aliases, add note for sdk-release Co-authored-by: 6543 <6543@obermui.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/173 Reviewed-by: Andrew Thornton <art27@cantab.net> Reviewed-by: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
23
modules/utils/format.go
Normal file
23
modules/utils/format.go
Normal file
@ -0,0 +1,23 @@
|
||||
// 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 utils
|
||||
|
||||
import "fmt"
|
||||
|
||||
// FormatSize get kb in int and return string
|
||||
func FormatSize(kb int64) string {
|
||||
if kb < 1024 {
|
||||
return fmt.Sprintf("%d Kb", kb)
|
||||
}
|
||||
mb := kb / 1024
|
||||
if mb < 1024 {
|
||||
return fmt.Sprintf("%d Mb", mb)
|
||||
}
|
||||
gb := mb / 1024
|
||||
if gb < 1024 {
|
||||
return fmt.Sprintf("%d Gb", gb)
|
||||
}
|
||||
return fmt.Sprintf("%d Tb", gb/1024)
|
||||
}
|
Reference in New Issue
Block a user