Skip to content

Commit 146e1f7

Browse files
committed
truncate stack names that are ridiculously long
1 parent ce2c98f commit 146e1f7

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ bin/*
2626
*/.DS_Store
2727
.DS_Store
2828
target
29+
*.tgz

src/github.oncue.verizon.net/iptv/nelson/stack.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ func Redeploy(guid string, http *gorequest.SuperAgent, cfg *Config) (str string,
226226
}
227227
}
228228

229-
/////////////////// LISTING STACKs ///////////////////
229+
/////////////////// LISTING STACKS ///////////////////
230230

231231
/**
232232
* {
@@ -291,7 +291,7 @@ func ListStacks(delimitedDcs string, delimitedNamespaces string, delimitedStatus
291291
func PrintListStacks(stacks []Stack) {
292292
var tabulized = [][]string{}
293293
for _, s := range stacks {
294-
tabulized = append(tabulized, []string{s.Guid, s.NamespaceRef, s.StackName, s.Status, s.Plan, s.Workflow, javaEpochToHumanizedTime(s.DeployedAt)})
294+
tabulized = append(tabulized, []string{s.Guid, s.NamespaceRef, truncateString(s.StackName, 55), s.Status, s.Plan, s.Workflow, javaEpochToHumanizedTime(s.DeployedAt)})
295295
}
296296

297297
RenderTableToStdout([]string{"GUID", "Namespace", "Stack", "Status", "Plan", "Workflow", "Deployed At"}, tabulized)

src/github.oncue.verizon.net/iptv/nelson/util.go

+11
Original file line numberDiff line numberDiff line change
@@ -119,3 +119,14 @@ func getVersionForMode(globalBuildVersion string) string {
119119
return "0.5." + globalBuildVersion
120120
}
121121
}
122+
123+
func truncateString(str string, num int) string {
124+
bnoden := str
125+
if len(str) > num {
126+
if num > 3 {
127+
num -= 3
128+
}
129+
bnoden = str[0:num] + "..."
130+
}
131+
return bnoden
132+
}

0 commit comments

Comments
 (0)