Output formatting change for smaller screens
This commit is contained in:
parent
b320fbb580
commit
1ed08dcf58
1 changed files with 16 additions and 7 deletions
19
main.go
19
main.go
|
@ -190,6 +190,14 @@ func printCharacterSkillQueue(swaggerclient *ESI.App, m *Character) {
|
||||||
}
|
}
|
||||||
skillNames := getUniverseNames(swaggerclient, &snIds)
|
skillNames := getUniverseNames(swaggerclient, &snIds)
|
||||||
|
|
||||||
|
maxSkillLength := 0
|
||||||
|
for _, skill := range skillqueue {
|
||||||
|
name := skillNames[*skill.SkillID]
|
||||||
|
if maxSkillLength < len(name) {
|
||||||
|
maxSkillLength = len(name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, skill := range skillqueue {
|
for _, skill := range skillqueue {
|
||||||
// element is the element from someSlice for where we are
|
// element is the element from someSlice for where we are
|
||||||
name := skillNames[*skill.SkillID]
|
name := skillNames[*skill.SkillID]
|
||||||
|
@ -197,21 +205,22 @@ func printCharacterSkillQueue(swaggerclient *ESI.App, m *Character) {
|
||||||
finishDate := time.Time(skill.FinishDate)
|
finishDate := time.Time(skill.FinishDate)
|
||||||
duration := finishDate.Sub(now)
|
duration := finishDate.Sub(now)
|
||||||
|
|
||||||
|
maxSkillFormat := fmt.Sprintf("%d", maxSkillLength)
|
||||||
|
|
||||||
// see https://github.com/ccpgames/esi-issues/issues/113
|
// see https://github.com/ccpgames/esi-issues/issues/113
|
||||||
// The queue is only updated when the user logs in with the client
|
// The queue is only updated when the user logs in with the client
|
||||||
// we thus need to do the computations and filtering ourselves
|
// we thus need to do the computations and filtering ourselves
|
||||||
if finishDate.Before(time.Now()) {
|
if finishDate.Before(time.Now()) {
|
||||||
fmt.Printf(" ✔ % 32s - L%d\n",
|
fmt.Printf("✔ % "+maxSkillFormat+"s - L%d\n",
|
||||||
name,
|
name,
|
||||||
*skill.FinishedLevel,
|
*skill.FinishedLevel,
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("% 35s - L%d - %s to %s (%s)\n",
|
fmt.Printf(" % "+maxSkillFormat+"s - L%d - ends on %s (%s)\n",
|
||||||
name,
|
name,
|
||||||
*skill.FinishedLevel,
|
*skill.FinishedLevel,
|
||||||
time.Time(skill.StartDate).Format(defaultDateFormat),
|
|
||||||
time.Time(skill.FinishDate).Format(defaultDateFormat),
|
time.Time(skill.FinishDate).Format(defaultDateFormat),
|
||||||
formatDuration(duration),
|
formatDuration(duration),
|
||||||
)
|
)
|
||||||
|
@ -366,7 +375,7 @@ func printCharacterPlanets(swaggerclient *ESI.App, m *Character) {
|
||||||
duration = time.Time(pin.ExpiryTime).Sub(now)
|
duration = time.Time(pin.ExpiryTime).Sub(now)
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf(" %s Extractor % 5ds cycle, %s, % 6d per cycle, %s %s (%s)\n",
|
fmt.Printf(" %s Extractor % 4ds cycle, %s, %d per cycle, %s %s (%s)\n",
|
||||||
status,
|
status,
|
||||||
*pin.ExtractorDetails.CycleTime,
|
*pin.ExtractorDetails.CycleTime,
|
||||||
pinNames[*pin.ExtractorDetails.ProductTypeID],
|
pinNames[*pin.ExtractorDetails.ProductTypeID],
|
||||||
|
@ -383,7 +392,7 @@ func printCharacterPlanets(swaggerclient *ESI.App, m *Character) {
|
||||||
log.Printf("Error on getSchematicsInformation: %T, %s\n", serr, serr)
|
log.Printf("Error on getSchematicsInformation: %T, %s\n", serr, serr)
|
||||||
fmt.Printf(" ✔ Factory ????? cycle, ?????\n")
|
fmt.Printf(" ✔ Factory ????? cycle, ?????\n")
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf(" ✔ Factory % 5ds cycle, %s\n",
|
fmt.Printf(" ✔ Factory % 4ds cycle, %s\n",
|
||||||
schematicInfo.CycleTime,
|
schematicInfo.CycleTime,
|
||||||
schematicInfo.SchematicName,
|
schematicInfo.SchematicName,
|
||||||
)
|
)
|
||||||
|
|
Reference in a new issue