mirror of
https://github.com/outbackdingo/ghorg.git
synced 2026-01-27 10:19:03 +00:00
Make reclone output more detailed (#457)
This commit is contained in:
@@ -5,6 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||
|
||||
## [1.10.1] - unreleased
|
||||
### Added
|
||||
- Reclone name and description to reclone output
|
||||
### Changed
|
||||
### Deprecated
|
||||
### Removed
|
||||
|
||||
@@ -73,15 +73,16 @@ func reCloneFunc(cmd *cobra.Command, argz []string) {
|
||||
}
|
||||
|
||||
if len(argz) == 0 {
|
||||
for _, key := range mapOfReClones {
|
||||
runReClone(key)
|
||||
for rcIdentifier, reclone := range mapOfReClones {
|
||||
runReClone(reclone, rcIdentifier)
|
||||
}
|
||||
} else {
|
||||
for _, arg := range argz {
|
||||
if _, ok := mapOfReClones[arg]; !ok {
|
||||
colorlog.PrintErrorAndExit(fmt.Sprintf("ERROR: The key %v was not found in reclone.yaml", arg))
|
||||
for _, rcIdentifier := range argz {
|
||||
if _, ok := mapOfReClones[rcIdentifier]; !ok {
|
||||
colorlog.PrintErrorAndExit(fmt.Sprintf("ERROR: The key %v was not found in reclone.yaml", rcIdentifier))
|
||||
} else {
|
||||
runReClone(mapOfReClones[rcIdentifier], rcIdentifier)
|
||||
}
|
||||
runReClone(mapOfReClones[arg])
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,7 +131,7 @@ func sanitizeCmd(cmd string) string {
|
||||
return cmd
|
||||
}
|
||||
|
||||
func runReClone(rc ReClone) {
|
||||
func runReClone(rc ReClone, rcIdentifier string) {
|
||||
// make sure command starts with ghorg clone
|
||||
splitCommand := strings.Split(rc.Cmd, " ")
|
||||
ghorg, clone, remainingCommand := splitCommand[0], splitCommand[1], splitCommand[1:]
|
||||
@@ -143,6 +144,11 @@ func runReClone(rc ReClone) {
|
||||
|
||||
if !isQuietReClone() {
|
||||
fmt.Println("")
|
||||
colorlog.PrintInfo(fmt.Sprintf("Running reclone: %v", rcIdentifier))
|
||||
if rc.Description != "" {
|
||||
colorlog.PrintInfo(fmt.Sprintf("Description: %v", rc.Description))
|
||||
fmt.Println("")
|
||||
}
|
||||
colorlog.PrintInfo(fmt.Sprintf("> %v", safeToLogCmd))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user