Skip to content

Commit

Permalink
Merge pull request #685 from Scalingo/feat/CRON-89/add-fields-cron
Browse files Browse the repository at this point in the history
Add fields to cron tasks list
  • Loading branch information
TheoEb committed Oct 20, 2021
2 parents f398821 + f857ba5 commit 874f4fc
Show file tree
Hide file tree
Showing 35 changed files with 84 additions and 55 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

### To be Released
* feat(cron-task): Add fields to cron tasks list [#685](https://github.com/Scalingo/cli/pull/685)

### 1.21.1

Expand Down
15 changes: 11 additions & 4 deletions crontasks/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@ package crontasks
import (
"os"

"github.com/olekukonko/tablewriter"
"gopkg.in/errgo.v1"

"github.com/Scalingo/cli/config"
"github.com/Scalingo/cli/utils"
httpclient "github.com/Scalingo/go-scalingo/v4/http"
"github.com/Scalingo/go-utils/errors"
"github.com/olekukonko/tablewriter"
"gopkg.in/errgo.v1"
)

func List(app string) error {
Expand All @@ -28,10 +30,15 @@ func List(app string) error {

t := tablewriter.NewWriter(os.Stdout)
t.SetColWidth(60)
t.SetHeader([]string{"Command", "Size"})
t.SetHeader([]string{"Command", "Size", "Last execution", "Next execution"})

for _, job := range cronTasks.Jobs {
t.Append([]string{job.Command, job.Size})
lastExecution := job.LastExecutionDate.Format(utils.TimeFormat)
if job.LastExecutionDate.IsZero() {
lastExecution = "No previous executions"
}

t.Append([]string{job.Command, job.Size, lastExecution, job.NextExecutionDate.Format(utils.TimeFormat)})
}
t.Render()

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ go 1.16

require (
github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5
github.com/Scalingo/go-scalingo/v4 v4.14.2
github.com/Scalingo/go-scalingo/v4 v4.14.3
github.com/Scalingo/go-utils/errors v1.0.0
github.com/Scalingo/go-utils/retry v1.0.0
github.com/andrew-d/go-termutil v0.0.0-20150726205930-009166a695a2
Expand Down
10 changes: 2 additions & 8 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,8 @@ github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7 h1:YoJbenK9C6
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7/go.mod h1:z4/9nQmJSSwwds7ejkxaJwO37dru3geImFUdJlaLzQo=
github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5 h1:VauE2GcJNZFun2Och6tIT2zJZK1v6jxALQDA9BIji/E=
github.com/ScaleFT/sshkeys v0.0.0-20200327173127-6142f742bca5/go.mod h1:gxOHeajFfvGQh/fxlC8oOKBe23xnnJTif00IFFbiT+o=
github.com/Scalingo/go-scalingo/v4 v4.14.1 h1:2QM7/TOaixLvp3+BsW8kR307LbFwzequzcZoqM/lCyU=
github.com/Scalingo/go-scalingo/v4 v4.14.1/go.mod h1:GHFZjiKGI3xC0igpx4CtRErBSUmMS0QI6sU080lEkKA=
github.com/Scalingo/go-scalingo/v4 v4.14.2-0.20211012092626-2b5c0dae107c h1:Yd/udfiixnp7xkAGv131v0ZTxvoAew5TiLnmHN2wP7A=
github.com/Scalingo/go-scalingo/v4 v4.14.2-0.20211012092626-2b5c0dae107c/go.mod h1:GHFZjiKGI3xC0igpx4CtRErBSUmMS0QI6sU080lEkKA=
github.com/Scalingo/go-scalingo/v4 v4.14.2-0.20211012094544-a3748506ae9d h1:JTBMFE1C+EKk8zYJFcOs/V2X3vONWDPFxvo9M8iYCNc=
github.com/Scalingo/go-scalingo/v4 v4.14.2-0.20211012094544-a3748506ae9d/go.mod h1:GHFZjiKGI3xC0igpx4CtRErBSUmMS0QI6sU080lEkKA=
github.com/Scalingo/go-scalingo/v4 v4.14.2 h1:+2lzo3o0R3rEKO7J9arfWKN1YztkS90SshwLlUVzzb0=
github.com/Scalingo/go-scalingo/v4 v4.14.2/go.mod h1:GHFZjiKGI3xC0igpx4CtRErBSUmMS0QI6sU080lEkKA=
github.com/Scalingo/go-scalingo/v4 v4.14.3 h1:RrEYCWTvD2R7JVFV21FZuJB+t0DZDJwyj6Mzxr1YdJ4=
github.com/Scalingo/go-scalingo/v4 v4.14.3/go.mod h1:GHFZjiKGI3xC0igpx4CtRErBSUmMS0QI6sU080lEkKA=
github.com/Scalingo/go-utils/errors v1.0.0 h1:9+1zBmT+d0kpAReChheUDX0AmT0/OtrDtHdwRymRufA=
github.com/Scalingo/go-utils/errors v1.0.0/go.mod h1:X1v0A4DBs4exBWGjYsGLo6nsC49vqf2hEVtigTRv7iY=
github.com/Scalingo/go-utils/retry v1.0.0 h1:aGT9Voe4rVEzn0bZ68x+nyBvk2sJWrzLP37+tTVdCuc=
Expand Down
4 changes: 4 additions & 0 deletions vendor/github.com/Scalingo/go-scalingo/v4/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions vendor/github.com/Scalingo/go-scalingo/v4/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions vendor/github.com/Scalingo/go-scalingo/v4/addons_providers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/Scalingo/go-scalingo/v4/apps.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/Scalingo/go-scalingo/v4/backups.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/Scalingo/go-scalingo/v4/client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/Scalingo/go-scalingo/v4/container.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions vendor/github.com/Scalingo/go-scalingo/v4/cron_tasks.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/Scalingo/go-scalingo/v4/databases.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/Scalingo/go-scalingo/v4/deployments.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions vendor/github.com/Scalingo/go-scalingo/v4/domains.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/Scalingo/go-scalingo/v4/events.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/Scalingo/go-scalingo/v4/events_types.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/Scalingo/go-scalingo/v4/log_drains.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/github.com/Scalingo/go-scalingo/v4/logs-archives.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/Scalingo/go-scalingo/v4/logs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/Scalingo/go-scalingo/v4/notifiers.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/Scalingo/go-scalingo/v4/operations.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/Scalingo/go-scalingo/v4/regions.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion vendor/github.com/Scalingo/go-scalingo/v4/run.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 874f4fc

Please sign in to comment.