mirror of
https://github.com/outbackdingo/ghorg.git
synced 2026-01-27 18:18:58 +00:00
better logging
This commit is contained in:
@@ -196,7 +196,6 @@ func cloneFunc(cmd *cobra.Command, argz []string) {
|
||||
os.Setenv("GHORG_GITEA_TOKEN", cmd.Flag("token").Value.String())
|
||||
}
|
||||
}
|
||||
|
||||
err := configs.VerifyTokenSet()
|
||||
if err != nil {
|
||||
colorlog.PrintError(err)
|
||||
@@ -836,7 +835,7 @@ func PrintConfigs() {
|
||||
colorlog.PrintInfo("* Exclude Regex : " + os.Getenv("GHORG_EXCLUDE_MATCH_REGEX"))
|
||||
}
|
||||
if os.Getenv("GHORG_MATCH_PREFIX") != "" {
|
||||
colorlog.PrintInfo("* Prefix Match: " + os.Getenv("GHORG_MATCH_PREFIX"))
|
||||
colorlog.PrintInfo("* Prefix Match : " + os.Getenv("GHORG_MATCH_PREFIX"))
|
||||
}
|
||||
if os.Getenv("GHORG_EXCLUDE_MATCH_PREFIX") != "" {
|
||||
colorlog.PrintInfo("* Exclude Prefix: " + os.Getenv("GHORG_EXCLUDE_MATCH_PREFIX"))
|
||||
|
||||
@@ -54,6 +54,20 @@ func reCloneFunc(cmd *cobra.Command, argz []string) {
|
||||
}
|
||||
}
|
||||
|
||||
printFinalOutput(argz, mapOfReClones)
|
||||
}
|
||||
|
||||
func printFinalOutput(argz []string, reCloneMap map[string]ReClone) {
|
||||
if len(argz) == 0 {
|
||||
for key, value := range reCloneMap {
|
||||
fmt.Printf("%v: %v\n", key, value)
|
||||
}
|
||||
} else {
|
||||
for _, arg := range argz {
|
||||
key, value := reCloneMap[arg]
|
||||
fmt.Printf("%v: %v\n", key, value)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func runReClone(rc ReClone) {
|
||||
@@ -72,17 +86,17 @@ func runReClone(rc ReClone) {
|
||||
colorlog.PrintErrorAndExit(e)
|
||||
}
|
||||
|
||||
err = ghorgClone.Start()
|
||||
|
||||
if err != nil {
|
||||
e := fmt.Sprintf("ERROR: Running ghorg clone cmd: %v, err: %v", rc.Cmd, err)
|
||||
colorlog.PrintErrorAndExit(e)
|
||||
}
|
||||
ghorgClone.Start()
|
||||
|
||||
scanner := bufio.NewScanner(stdout)
|
||||
for scanner.Scan() {
|
||||
m := scanner.Text()
|
||||
fmt.Println(m)
|
||||
}
|
||||
ghorgClone.Wait()
|
||||
|
||||
err = ghorgClone.Wait()
|
||||
if err != nil {
|
||||
e := fmt.Sprintf("ERROR: Running ghorg clone cmd: %v, err: %v", rc.Cmd, err)
|
||||
colorlog.PrintErrorAndExit(e)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user