0
0
mirror of https://github.com/bryanpedini/gitea-mirror.git synced 2024-11-22 22:12:24 +00:00

added StringSliceToMap util, performed github migration only on request

This commit is contained in:
Bryan Joshua Pedini 2020-01-09 13:14:35 +01:00
parent 600406e957
commit 2fd268f520
2 changed files with 29 additions and 2 deletions

14
main.go
View File

@ -1,6 +1,20 @@
package main package main
import (
"fmt"
"os"
"github.com/bryanpedini/gitea-mirror-gitea/utils"
)
func main() { func main() {
commandLineArgumentsSlice := os.Args[1:]
commandLineArguments := utils.StringSliceToMap(commandLineArgumentsSlice)
if _, ok := commandLineArguments["--github"]; ok {
githubOrg, githubToken, giteaHost, giteaToken := "", "", "", "" githubOrg, githubToken, giteaHost, giteaToken := "", "", "", ""
migrateGithubToGitea(githubOrg, githubToken, giteaHost, giteaToken) migrateGithubToGitea(githubOrg, githubToken, giteaHost, giteaToken)
} else {
fmt.Println("Usage: " + os.Args[0] + " [--github]")
}
} }

13
utils/sliceToMap.go Normal file
View File

@ -0,0 +1,13 @@
package utils
// StringSliceToMap Converts a slice of strings into a map formed by
// keys equals to the slice values, and empty strings as map values.
func StringSliceToMap(slice []string) map[string]string {
ret := make(map[string]string)
for i := 0; i < len(slice); i++ {
ret[slice[i]] = ""
}
return ret
}