Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
kobayashi committed Jan 9, 2022
1 parent 85badb6 commit fe94640
Show file tree
Hide file tree
Showing 18 changed files with 730 additions and 451 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: release
on:
push:
tags:
- "*"
jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.x
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29 changes: 29 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Test
on:
push:
branches:
- "*"
pull_request: {}
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macOS-latest
steps:
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.x
- name: Checkout
uses: actions/checkout@v2
- name: Lint
run: |
GO111MODULE=off GOBIN=$(pwd)/bin go get golang.org/x/lint/golint
bin/golint -set_exit_status ./...
if: "matrix.os == 'ubuntu-latest' || matrix.os == 'macOS-latest'"
- name: Test
run: go test -v ./...
28 changes: 28 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
project_name: eol
release:
prerelease: auto
env:
- GO111MODULE=on
before:
hooks:
- go mod tidy
builds:
- main: .
env:
- CGO_ENABLED=0
binary: eol
ldflags:
- -s -w
- -X main.Version={{.Version}}
- -X main.Revision={{.ShortCommit}}
archives:
- name_template: '{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}'
replacements:
darwin: darwin
linux: linux
windows: windows
386: i386
amd64: x86_64
format_overrides:
- goos: windows
format: zip
93 changes: 93 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# eol

`eol` is command line tool for [endoflife.date](https://endoflife.date/). This is mostly inspired from [norwegianblue](https://github.com/hugovk/norwegianblue) built in python.

## usage

- get list of projects

```
$ eol all
alpine
amazon-eks
amazon-linux
android
...
```

- get project matrix

Check EOL status for a project in the list.

```
$ eol project go
+-------+-----+------------+---------+
| CYCLE | EOL | RELEASE | LATEST |
+-------+-----+------------+---------+
| 1.17 | no | 2021-08-16 | 1.17.6 |
| 1.16 | no | 2021-02-16 | 1.16.13 |
| 1.15 | yes | 2020-08-11 | 1.15.15 |
| 1.14 | yes | 2020-02-25 | 1.14.15 |
| 1.13 | yes | 2019-09-03 | 1.13.15 |
| 1.12 | yes | 2019-02-25 | 1.12.17 |
| 1.11 | yes | 2018-08-04 | 1.11.13 |
| 1.10 | yes | 2018-02-16 | 1.10.8 |
+-------+-----+------------+---------+
```

- get a matrix for a any version of a project

```
$ eol project go 1.17
+------------+-----+--------+----------------+
| RELEASE | EOL | LATEST | CYCLESHORTHAND |
+------------+-----+--------+----------------+
| 2021-08-16 | no | 1.17.6 | 117 |
+------------+-----+--------+----------------+
```

## Custom output format

- markdown

```markdown
$ eol project go 1.17 -f markdown
| Release | EOL | Latest | CycleShortHand |
| --- | --- | --- | ---:|
| 2021-08-16 | no | 1.17.6 | 117 |
```

- csv

```csv
eol project go 1.17 -f csv
Release,EOL,Latest,CycleShortHand
2021-08-16,no,1.17.6,117
```

- html

```html
eol project go 1.17 -f html
<table class="go-pretty-table">
<thead>
<tr>
<th>Release</th>
<th>EOL</th>
<th>Latest</th>
<th align="right">CycleShortHand</th>
</tr>
</thead>
<tbody>
<tr>
<td>2021-08-16</td>
<td>no</td>
<td>1.17.6</td>
<td align="right">117</td>
</tr>
</tbody>
</table>

```
51 changes: 4 additions & 47 deletions cmd/all.go
Original file line number Diff line number Diff line change
@@ -1,62 +1,19 @@
/*
Copyright © 2022 kobayashi <[email protected]>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
package cmd

import (
"context"
"fmt"
"log"

"github.com/kobayashi/eol/api"
"github.com/kobayashi/eol/pkg/commands"
"github.com/spf13/cobra"
)

// allCmd represents the all command
var allCmd = &cobra.Command{
Use: "all",
Short: "List all available projects",
Run: func(cmd *cobra.Command, args []string) {
c := api.NewHTTPClient()
ctx := context.Background()
res, err := c.GetAll(ctx)
if err != nil {
log.Fatal(err)
}
for _, p := range res {
fmt.Println(p)
}
Short: "list all available projects",
RunE: func(cmd *cobra.Command, args []string) error {
return commands.RunAll()
},
}

func init() {
rootCmd.AddCommand(allCmd)

// Here you will define your flags and configuration settings.

// Cobra supports Persistent Flags which will work for this command
// and all subcommands, e.g.:
// allCmd.PersistentFlags().String("foo", "", "A help for foo")

// Cobra supports local flags which will only run when this command
// is called directly, e.g.:
// allCmd.Flags().BoolP("toggle", "t", false, "Help message for toggle")
}
Loading

0 comments on commit fe94640

Please sign in to comment.