go fmt code, first step finished
This commit is contained in:
parent
fa6a0a751b
commit
750b3623b9
|
@ -13,9 +13,9 @@ var nesOpts = struct {
|
||||||
|
|
||||||
func GiteeCommand() *gcli.Command {
|
func GiteeCommand() *gcli.Command {
|
||||||
gitee := &gcli.Command{
|
gitee := &gcli.Command{
|
||||||
Func: syncGitee,
|
Func: syncGitee,
|
||||||
Name: "gitee",
|
Name: "gitee",
|
||||||
UseFor: "This command is used for sync local repo to Gitee",
|
UseFor: "This command is used for sync local repo to Gitee",
|
||||||
Examples: `Simple usage: <cyan>{$binName} {$cmd} /Users/Zoker/repos/</>`,
|
Examples: `Simple usage: <cyan>{$binName} {$cmd} /Users/Zoker/repos/</>`,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,4 +36,4 @@ func syncGitee(c *gcli.Command, args []string) error {
|
||||||
share.ReadyToAuth(args[0])
|
share.ReadyToAuth(args[0])
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ func GetGitDir(repoDir string) (repos []string, err error) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
repoPath := repoDir + pathSep + repo.Name() // todo check repo path valid
|
repoPath := repoDir + pathSep + repo.Name() // todo check repo path valid
|
||||||
if isGitRepo(repoPath) { // todo goroutine
|
if isGitRepo(repoPath) { // todo goroutine
|
||||||
repos = append(repos, repoPath)
|
repos = append(repos, repoPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ func printRepos(repos []string) {
|
||||||
|
|
||||||
func repoSize(path string) (float32, bool, error) {
|
func repoSize(path string) (float32, bool, error) {
|
||||||
var size int64
|
var size int64
|
||||||
err := filepath.Walk(path,func(_ string,info os.FileInfo,err error) error {
|
err := filepath.Walk(path, func(_ string, info os.FileInfo, err error) error {
|
||||||
if !info.IsDir() {
|
if !info.IsDir() {
|
||||||
size += info.Size()
|
size += info.Size()
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ func repoSize(path string) (float32, bool, error) {
|
||||||
})
|
})
|
||||||
|
|
||||||
outOf1G := false
|
outOf1G := false
|
||||||
if size > 1024 * 1024 * 1024 {
|
if size > 1024*1024*1024 {
|
||||||
outOf1G = true
|
outOf1G = true
|
||||||
}
|
}
|
||||||
sizeMB := float32(size) / 1024.0 / 1024.0
|
sizeMB := float32(size) / 1024.0 / 1024.0
|
||||||
|
@ -121,4 +121,4 @@ func ReadyToAuth(repoDir string) []string {
|
||||||
|
|
||||||
func ExitMessage() {
|
func ExitMessage() {
|
||||||
color.Yellow.Println("Bye, see you next time!")
|
color.Yellow.Println("Bye, see you next time!")
|
||||||
}
|
}
|
||||||
|
|
3
up2.go
3
up2.go
|
@ -2,6 +2,7 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"up2GitX/platform"
|
"up2GitX/platform"
|
||||||
|
|
||||||
"github.com/gookit/gcli/v2"
|
"github.com/gookit/gcli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -11,4 +12,4 @@ func main() {
|
||||||
up2.Description = "A tool for easily sync multiple local repo to different platform like Gitee, Github or Gitlab"
|
up2.Description = "A tool for easily sync multiple local repo to different platform like Gitee, Github or Gitlab"
|
||||||
up2.Add(platform.GiteeCommand())
|
up2.Add(platform.GiteeCommand())
|
||||||
up2.Run()
|
up2.Run()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue