Output formatting change for smaller screens

This commit is contained in:
Thomas Schwery 2017-02-14 07:15:04 +00:00
parent b320fbb580
commit 1ed08dcf58

23
main.go
View file

@ -190,6 +190,14 @@ func printCharacterSkillQueue(swaggerclient *ESI.App, m *Character) {
}
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 {
// element is the element from someSlice for where we are
name := skillNames[*skill.SkillID]
@ -197,21 +205,22 @@ func printCharacterSkillQueue(swaggerclient *ESI.App, m *Character) {
finishDate := time.Time(skill.FinishDate)
duration := finishDate.Sub(now)
maxSkillFormat := fmt.Sprintf("%d", maxSkillLength)
// see https://github.com/ccpgames/esi-issues/issues/113
// The queue is only updated when the user logs in with the client
// we thus need to do the computations and filtering ourselves
if finishDate.Before(time.Now()) {
fmt.Printf(" ✔ % 32s - L%d\n",
fmt.Printf("✔ % "+maxSkillFormat+"s - L%d\n",
name,
*skill.FinishedLevel,
)
continue
}
fmt.Printf("% 35s - L%d - %s to %s (%s)\n",
fmt.Printf(" % "+maxSkillFormat+"s - L%d - ends on %s (%s)\n",
name,
*skill.FinishedLevel,
time.Time(skill.StartDate).Format(defaultDateFormat),
time.Time(skill.FinishDate).Format(defaultDateFormat),
formatDuration(duration),
)
@ -329,7 +338,7 @@ func printCharacterPlanets(swaggerclient *ESI.App, m *Character) {
planetName := getPlanetInformation(swaggerclient, *planet.PlanetID)
fmt.Printf(" Planet %s, %s - %s, level %d with %d structures - Updated %s\n",
fmt.Printf("Planet %s, %s - %s, level %d with %d structures - Updated %s\n",
planetName.PlanetName,
solarSystemInfo.SolarSystemName,
*planet.PlanetType,
@ -366,7 +375,7 @@ func printCharacterPlanets(swaggerclient *ESI.App, m *Character) {
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,
*pin.ExtractorDetails.CycleTime,
pinNames[*pin.ExtractorDetails.ProductTypeID],
@ -381,9 +390,9 @@ func printCharacterPlanets(swaggerclient *ESI.App, m *Character) {
schematicInfo, serr := getSchematicsInformation(swaggerclient, pin.SchematicID)
if serr != nil {
log.Printf("Error on getSchematicsInformation: %T, %s\n", serr, serr)
fmt.Printf(" ✔ Factory ????? cycle, ?????\n")
fmt.Printf(" ✔ Factory ????? cycle, ?????\n")
} else {
fmt.Printf(" ✔ Factory % 5ds cycle, %s\n",
fmt.Printf(" ✔ Factory % 4ds cycle, %s\n",
schematicInfo.CycleTime,
schematicInfo.SchematicName,
)