Skip to content

Commit

Permalink
Merge pull request #221 from HacDan/urfave-cliv2
Browse files Browse the repository at this point in the history
chore(dep upgrade): Update urfave/cli to V2
  • Loading branch information
kenliu authored Apr 11, 2023
2 parents 3faf93b + dc5ccba commit b057a90
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 82 deletions.
4 changes: 2 additions & 2 deletions add.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"strings"

"github.com/sachaos/todoist/lib"
"github.com/urfave/cli"
todoist "github.com/sachaos/todoist/lib"
"github.com/urfave/cli/v2"
)

var priorityMapping = map[int]int{
Expand Down
4 changes: 2 additions & 2 deletions add_project.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package main
import (
"context"

"github.com/sachaos/todoist/lib"
"github.com/urfave/cli"
todoist "github.com/sachaos/todoist/lib"
"github.com/urfave/cli/v2"
)

func AddProject(c *cli.Context) error {
Expand Down
4 changes: 2 additions & 2 deletions close.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package main
import (
"context"

"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

func Close(c *cli.Context) error {
client := GetClient(c)

item_ids := []string{}
for _, arg := range c.Args() {
for _, arg := range c.Args().Slice() {
item_ids = append(item_ids, arg)
}

Expand Down
6 changes: 3 additions & 3 deletions completed.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package main
import (
"context"

"github.com/sachaos/todoist/lib"
todoist "github.com/sachaos/todoist/lib"

"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

func CompletedList(c *cli.Context) error {
Expand All @@ -27,7 +27,7 @@ func CompletedList(c *cli.Context) error {

defer writer.Flush()

if c.GlobalBool("header") {
if c.Bool("header") {
writer.Write([]string{"ID", "CompletedDate", "Project", "Content"})
}

Expand Down
4 changes: 2 additions & 2 deletions delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ package main
import (
"context"

"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

func Delete(c *cli.Context) error {
client := GetClient(c)

item_ids := []string{}
for _, arg := range c.Args() {
for _, arg := range c.Args().Slice() {
item_id, err := client.CompleteItemIDByPrefix(arg)
if err != nil {
return err
Expand Down
10 changes: 5 additions & 5 deletions format.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"time"

"github.com/fatih/color"
"github.com/sachaos/todoist/lib"
"github.com/urfave/cli"
todoist "github.com/sachaos/todoist/lib"
"github.com/urfave/cli/v2"
)

func ColorList() []color.Attribute {
Expand Down Expand Up @@ -46,10 +46,10 @@ func IdFormat(carrier todoist.IDCarrier) string {
}

func ContentPrefix(store *todoist.Store, item *todoist.Item, depth int, c *cli.Context) (prefix string) {
if c.GlobalBool("indent") {
if c.Bool("indent") {
prefix = prefix + strings.Repeat(" ", depth)
}
if c.GlobalBool("namespace") {
if c.Bool("namespace") {
parents := todoist.SearchItemParents(store, item)
for _, parent := range parents {
prefix = prefix + parent.Content + ":"
Expand Down Expand Up @@ -95,7 +95,7 @@ func ProjectFormat(id string, store *todoist.Store, projectColorHash map[string]
}

projectName := project.Name
if c.GlobalBool("project-namespace") {
if c.Bool("project-namespace") {
parentProjects := todoist.SearchProjectParents(store, project)
for _, project := range parentProjects {
namePrefix = namePrefix + project.Name + ":"
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ require (
github.com/rkoesters/xdg v0.0.0-20181125232953-edd15b846f9b
github.com/spf13/viper v1.15.0
github.com/stretchr/testify v1.8.1
github.com/urfave/cli v1.22.12
github.com/urfave/cli/v2 v2.25.1
)

require (
Expand All @@ -30,6 +30,7 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/sys v0.3.0 // indirect
golang.org/x/text v0.5.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9
cloud.google.com/go/storage v1.14.0/go.mod h1:GrKmX003DSIwi9o29oFT7YDnHYwZoctc3fOKtUw0Xmo=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.2.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d h1:licZJFw2RwpHMqeKTCYkitsPqHNxTmd4SNR5r94FGM8=
github.com/acarl005/stripansi v0.0.0-20180116102854-5a71ef0e047d/go.mod h1:asat636LX7Bqt5lYEZ27JNDcqxfjdBQuJ/MM4CN/Lzo=
Expand Down Expand Up @@ -188,8 +187,10 @@ github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKs
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8=
github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
github.com/urfave/cli v1.22.12 h1:igJgVw1JdKH+trcLWLeLwZjU9fEfPesQ+9/e4MQ44S8=
github.com/urfave/cli v1.22.12/go.mod h1:sSBEIC79qR6OvcmsD4U3KABeOTxDqQtdDnaFuUN30b8=
github.com/urfave/cli/v2 v2.25.1 h1:zw8dSP7ghX0Gmm8vugrs6q9Ku0wzweqPyshy+syu9Gw=
github.com/urfave/cli/v2 v2.25.1/go.mod h1:GHupkWPMM0M/sj1a2b4wUrWBPzazNrIjouW6fmdJLxc=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRTfdpNzjtPYqr8smhKouy9mxVdGPU=
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down Expand Up @@ -488,7 +489,6 @@ gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
Expand Down
2 changes: 1 addition & 1 deletion karma.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package main
import (
"fmt"

"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

func Karma(c *cli.Context) error {
Expand Down
4 changes: 2 additions & 2 deletions labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"os"
"text/tabwriter"

"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

func Labels(c *cli.Context) error {
Expand All @@ -15,7 +15,7 @@ func Labels(c *cli.Context) error {

defer writer.Flush()

if c.GlobalBool("header") {
if c.Bool("header") {
writer.Write([]string{"ID", "Name"})
}

Expand Down
4 changes: 2 additions & 2 deletions list.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/acarl005/stripansi"
todoist "github.com/sachaos/todoist/lib"
"github.com/urfave/cli"
"github.com/urfave/cli/v2"
)

func traverseItems(item *todoist.Item, f func(item *todoist.Item, depth int), depth int) {
Expand Down Expand Up @@ -82,7 +82,7 @@ func List(c *cli.Context) error {

defer writer.Flush()

if c.GlobalBool("header") {
if c.Bool("header") {
writer.Write([]string{"ID", "Priority", "DueDate", "Project", "Labels", "Content"})
}

Expand Down
Loading

0 comments on commit b057a90

Please sign in to comment.