Skip to content

Commit

Permalink
some modification on output
Browse files Browse the repository at this point in the history
  • Loading branch information
infa-rsubbura committed Jan 25, 2022
1 parent a1fe35c commit 8236d4d
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions cmd/delhivery.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ func trackDelhivery(args []string, detailed bool) {
if !detailed {
reportLines = len(scans) - 4
}
var previousScanLocation string
for i := len(scans) - 1; i >= reportLines; i-- {
time, err := time.Parse(layout, scans[i].ScanDateTime)
if err != nil {
Expand All @@ -128,15 +129,23 @@ func trackDelhivery(args []string, detailed bool) {
scanstatus := strings.ToLower(scans[i].Scan)
var status string
switch {
case strings.Contains(scanstatus, "delivered"):
status = "πŸ™Œ..It's Delivered"
case strings.Contains(scanstatus, "dispatched"):
status = "🏠...Out for Delivery"
case strings.Contains(scanstatus, "pending"):
status = "βŒ›...Pending"
case strings.Contains(scanstatus, "transit"):
status = "🚚"
case strings.Contains(scanstatus, "manifest"):
status = "πŸ“’...Booked"
}
result := fmt.Sprint(time.Format(layout1), " @ ", scans[i].ScannedLocation, scans[i].Instructions, ".........................................")
fmt.Println(result[:100], status)
if previousScanLocation != scans[i].ScannedLocation {
fmt.Println("Location:", scans[i].ScannedLocation)
previousScanLocation = scans[i].ScannedLocation
}
result := fmt.Sprint(time.Format(layout1), " - ", scans[i].Instructions, "...............................................................................................")
fmt.Println(" ",result[:100], status)

}

Expand Down

0 comments on commit 8236d4d

Please sign in to comment.