fix: unstaged changes handling

See toolshed/organising#651
This commit is contained in:
2024-12-31 11:19:03 +01:00
parent bfed51a69c
commit 5975be6870
26 changed files with 622 additions and 56 deletions

View File

@ -61,18 +61,22 @@ func NewVersionOverview(
domain = config.NO_DOMAIN_DEFAULT
}
upperKind := strings.ToUpper(kind)
rows := [][]string{
{"APP", domain},
{"RECIPE", app.Recipe.Name},
{"SERVER", server},
{"DEPLOYED", deployedVersion},
{"CURRENT CHAOS ", deployedChaosVersion},
{fmt.Sprintf("TO %s", strings.ToUpper(kind)), toDeployVersion},
{"CONFIG", deployConfig},
{"CURRENT DEPLOYMENT", "---"},
{"VERSION", deployedVersion},
{"CHAOS ", deployedChaosVersion},
{upperKind, "---"},
{"VERSION", toDeployVersion},
}
overview := formatter.CreateOverview(
fmt.Sprintf("%s OVERVIEW", strings.ToUpper(kind)),
fmt.Sprintf("%s OVERVIEW", upperKind),
rows,
)
@ -131,15 +135,25 @@ func DeployOverview(
domain = config.NO_DOMAIN_DEFAULT
}
deployedChaosVersion = formatter.BoldDirtyDefault(deployedChaosVersion)
if app.Recipe.Dirty {
toDeployChaosVersion = formatter.BoldDirtyDefault(toDeployChaosVersion)
}
rows := [][]string{
{"APP", domain},
{"RECIPE", app.Recipe.Name},
{"SERVER", server},
{"DEPLOYED", deployedVersion},
{"CURRENT CHAOS ", deployedChaosVersion},
{"TO DEPLOY", toDeployVersion},
{"NEW CHAOS", toDeployChaosVersion},
{"CONFIG", deployConfig},
{"CURRENT DEPLOYMENT", "---"},
{"VERSION", deployedVersion},
{"CHAOS", deployedChaosVersion},
{"NEW DEPLOYMENT", "---"},
{"VERSION", toDeployVersion},
{"CHAOS", toDeployChaosVersion},
}
overview := formatter.CreateOverview("DEPLOY OVERVIEW", rows)
@ -187,13 +201,18 @@ func UndeployOverview(
domain = config.NO_DOMAIN_DEFAULT
}
if app.Recipe.Dirty {
chaosVersion = formatter.BoldDirtyDefault(chaosVersion)
}
rows := [][]string{
{"APP", domain},
{"RECIPE", app.Recipe.Name},
{"SERVER", server},
{"CONFIG", deployConfig},
{"CURRENT DEPLOYMENT", "---"},
{"DEPLOYED", version},
{"CHAOS", chaosVersion},
{"CONFIG", deployConfig},
}
overview := formatter.CreateOverview("UNDEPLOY OVERVIEW", rows)