Skip to content

Commit

Permalink
added additional product types, link, extended support
Browse files Browse the repository at this point in the history
  • Loading branch information
mr-pmillz committed Sep 4, 2024
1 parent edfece2 commit 2bfc22d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
16 changes: 11 additions & 5 deletions cmd/eoldate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func main() {
// Create a new table
tableString := &strings.Builder{}
table := tablewriter.NewWriter(tableString)
table.SetHeader([]string{"Cycle", "Release Date", "EOL Date", "Latest", "Latest Release Date", "LTS", "Support"})
table.SetHeader([]string{"Cycle", "Release Date", "EOL Date", "Latest", "Link", "Latest Release Date", "LTS", "Support", "Extended Support"})

table.SetHeaderColor(
tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiYellowColor, tablewriter.BgBlackColor},
Expand All @@ -75,6 +75,8 @@ func main() {
tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiYellowColor, tablewriter.BgBlackColor},
tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiYellowColor, tablewriter.BgBlackColor},
tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiYellowColor, tablewriter.BgBlackColor},
tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiYellowColor, tablewriter.BgBlackColor},
tablewriter.Colors{tablewriter.Bold, tablewriter.FgHiYellowColor, tablewriter.BgBlackColor},
)
// Get current date
currentDate := time.Now()
Expand All @@ -91,18 +93,18 @@ func main() {
fmt.Println("Error parsing date:", err)
continue
}
row = []string{release.Cycle, release.ReleaseDate, release.EOL.(string), release.Latest, release.LatestReleaseDate, fmt.Sprintf("%t", release.LTS), release.Support}
row = []string{release.Cycle, release.ReleaseDate, release.EOL.(string), release.Latest, release.Link, release.LatestReleaseDate, fmt.Sprintf("%s", release.LTS), fmt.Sprintf("%s", release.Support), fmt.Sprintf("%s", release.ExtendedSupport)}
}
if rt.Kind() == reflect.Bool {
EOLIsBool = true
row = []string{release.Cycle, release.ReleaseDate, "N/A", release.Latest, release.LatestReleaseDate, fmt.Sprintf("%t", release.LTS), release.Support}
row = []string{release.Cycle, release.ReleaseDate, "N/A", release.Latest, release.Link, release.LatestReleaseDate, fmt.Sprintf("%s", release.LTS), fmt.Sprintf("%s", release.Support), fmt.Sprintf("%s", release.ExtendedSupport)}
}

// Check if EOL date is older or later than the current date
if eolDateTime.Before(currentDate) && !EOLIsBool {
table.Rich(row, []tablewriter.Colors{{}, {}, tablewriter.Colors{tablewriter.FgRedColor}, {}, {}, {}, {}})
table.Rich(row, []tablewriter.Colors{{}, {}, {tablewriter.FgRedColor}, {}, {}, {}, {}})
} else {
table.Rich(row, []tablewriter.Colors{{}, {}, tablewriter.Colors{tablewriter.FgGreenColor}, {}, {}, {}, {}})
table.Rich(row, []tablewriter.Colors{{}, {}, {tablewriter.FgGreenColor}, {}, {}, {}, {}})
}
}

Expand All @@ -114,6 +116,8 @@ func main() {
tablewriter.ALIGN_CENTER,
tablewriter.ALIGN_CENTER,
tablewriter.ALIGN_CENTER,
tablewriter.ALIGN_CENTER,
tablewriter.ALIGN_CENTER,
})

table.SetAutoWrapText(true)
Expand All @@ -126,6 +130,8 @@ func main() {
"",
"",
"",
"",
"",
})
table.SetFooterAlignment(tablewriter.ALIGN_LEFT)

Expand Down
8 changes: 5 additions & 3 deletions eoldate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"net/http"
)

const CurrentVersion = `v0.0.4`
const CurrentVersion = `v0.0.5`
const EOLBaseURL = "https://endoflife.date/api"

// Options ...
Expand All @@ -24,9 +24,11 @@ type Product struct {
ReleaseDate string `json:"releaseDate,omitempty"`
EOL interface{} `json:"eol,omitempty"`
Latest string `json:"latest,omitempty"`
Link string `json:"link,omitempty"`
LatestReleaseDate string `json:"latestReleaseDate,omitempty"`
LTS bool `json:"lts,omitempty"`
Support string `json:"support,omitempty"`
LTS interface{} `json:"lts,omitempty"`
Support interface{} `json:"support,omitempty"`
ExtendedSupport interface{} `json:"extendedSupport,omitempty"`
}

type AllProducts []string
Expand Down

0 comments on commit 2bfc22d

Please sign in to comment.