Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): Upgrade urfave/cli to v2 #774

Merged
merged 4 commits into from
Sep 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

### To be Released

* chore(deps): Upgrade urfave/cli to v2 [#774](https://github.com/Scalingo/cli/pull/774)
Caution: scalingo commands must come before any flag or argument. For example
`scalingo --app hello-world restart` must be rewritten `scalingo restart --app hello-world`

# 1.24.2

* fix(releases): Correctly auto generate changelog [#772](https://github.com/Scalingo/cli/pull/772)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -300,7 +300,7 @@ Pushing the tag triggers a GitHub Action which builds the cross-platform binarie
When the GitHub Action finished, restart the Scalingo application `cli-download-service`:

```shell
scalingo --region osc-fr1 --app cli-download-service restart
scalingo restart --region osc-fr1 --app cli-download-service
```

It serves as cache between GitHub and our customers for a more efficient check of what is the new CLI version.
Expand Down
5 changes: 3 additions & 2 deletions cmd/addon_providers_list.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/urfave/cli"
"github.com/urfave/cli/v2"

"github.com/Scalingo/cli/addon_providers"
"github.com/Scalingo/cli/cmd/autocomplete"
Expand All @@ -13,10 +13,11 @@ var (
Category: "Addons - Global",
Description: "List all addons you can add to your app.",
Usage: "List all addons",
Action: func(c *cli.Context) {
Action: func(c *cli.Context) error {
if err := addon_providers.List(); err != nil {
errorQuit(err)
}
return nil
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "addons-list")
Expand Down
47 changes: 26 additions & 21 deletions cmd/addons.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/urfave/cli"
"github.com/urfave/cli/v2"

"github.com/Scalingo/cli/addons"
"github.com/Scalingo/cli/cmd/autocomplete"
Expand All @@ -13,16 +13,16 @@ var (
Name: "addons",
Category: "Addons",
Usage: "List used add-ons",
Flags: []cli.Flag{appFlag},
Flags: []cli.Flag{&appFlag},
Description: ` List all addons used by your app:
$ scalingo -a myapp addons

# See also 'addons-add' and 'addons-remove'
`,
Action: func(c *cli.Context) {
Action: func(c *cli.Context) error {
currentApp := detect.CurrentApp(c)
var err error
if len(c.Args()) == 0 {
if c.Args().Len() == 0 {
err = addons.List(currentApp)
} else {
cli.ShowCommandHelp(c, "addons")
Expand All @@ -31,6 +31,7 @@ var (
if err != nil {
errorQuit(err)
}
return nil
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "addons")
Expand All @@ -39,24 +40,25 @@ var (
AddonsAddCommand = cli.Command{
Name: "addons-add",
Category: "Addons",
Flags: []cli.Flag{appFlag},
Flags: []cli.Flag{&appFlag},
Usage: "Provision an add-on for your application",
Description: ` Provision an add-on for your application:
$ scalingo -a myapp addons-add <addon-name> <plan>

# See also 'addons-list' and 'addons-plans'
`,
Action: func(c *cli.Context) {
Action: func(c *cli.Context) error {
currentApp := detect.CurrentApp(c)
var err error
if len(c.Args()) == 2 {
err = addons.Provision(currentApp, c.Args()[0], c.Args()[1])
if c.Args().Len() == 2 {
err = addons.Provision(currentApp, c.Args().First(), c.Args().Slice()[1])
} else {
cli.ShowCommandHelp(c, "addons-add")
}
if err != nil {
errorQuit(err)
}
return nil
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "addons-add")
Expand All @@ -66,24 +68,25 @@ var (
AddonsRemoveCommand = cli.Command{
Name: "addons-remove",
Category: "Addons",
Flags: []cli.Flag{appFlag},
Flags: []cli.Flag{&appFlag},
Usage: "Remove an existing addon from your app",
Description: ` Remove an existing addon from your app:
$ scalingo -a myapp addons-remove <addon-id>

# See also 'addons' and 'addons-add'
`,
Action: func(c *cli.Context) {
Action: func(c *cli.Context) error {
currentApp := detect.CurrentApp(c)
var err error
if len(c.Args()) == 1 {
err = addons.Destroy(currentApp, c.Args()[0])
if c.Args().Len() == 1 {
err = addons.Destroy(currentApp, c.Args().First())
} else {
cli.ShowCommandHelp(c, "addons-remove")
}
if err != nil {
errorQuit(err)
}
return nil
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "addons-remove")
Expand All @@ -93,24 +96,25 @@ var (
AddonsUpgradeCommand = cli.Command{
Name: "addons-upgrade",
Category: "Addons",
Flags: []cli.Flag{appFlag},
Flags: []cli.Flag{&appFlag},
Usage: "Upgrade or downgrade an add-on attached to your app",
Description: ` Upgrade an addon attached to your app:
$ scalingo -a myapp addons-upgrade <addon-id> <plan>

# See also 'addons-plans' and 'addons-remove'
`,
Action: func(c *cli.Context) {
Action: func(c *cli.Context) error {
currentApp := detect.CurrentApp(c)
var err error
if len(c.Args()) == 2 {
err = addons.Upgrade(currentApp, c.Args()[0], c.Args()[1])
if c.Args().Len() == 2 {
err = addons.Upgrade(currentApp, c.Args().First(), c.Args().Slice()[1])
} else {
cli.ShowCommandHelp(c, "addons-upgrade")
}
if err != nil {
errorQuit(err)
}
return nil
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "addons-upgrade")
Expand All @@ -121,25 +125,26 @@ var (
Name: "addons-info",
Category: "Addons",
Usage: "Display information about an add-on attached to your app",
Flags: []cli.Flag{appFlag},
Flags: []cli.Flag{&appFlag},
Description: ` Display information about an add-on attached to your app:
$ scalingo --app my-app addons-info --addon <addon-id>

# See also 'addons' and 'addons-upgrade'
`,
Action: func(c *cli.Context) {
if len(c.Args()) != 1 {
Action: func(c *cli.Context) error {
if c.Args().Len() != 1 {
cli.ShowCommandHelp(c, "addons-info")
return
return nil
}

currentApp := detect.CurrentApp(c)
currentAddon := c.Args()[0]
currentAddon := c.Args().First()

err := addons.Info(currentApp, currentAddon)
if err != nil {
errorQuit(err)
}
return nil
},
BashComplete: func(c *cli.Context) {
autocomplete.CmdFlagsAutoComplete(c, "addons-info")
Expand Down
11 changes: 6 additions & 5 deletions cmd/addons_providers_plans_list.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package cmd

import (
"github.com/urfave/cli"
"github.com/urfave/cli/v2"

"github.com/Scalingo/cli/addon_providers"
"github.com/Scalingo/cli/cmd/autocomplete"
Expand All @@ -13,14 +13,15 @@ var (
Category: "Addons - Global",
Description: "List the plans for an addon.\n Example:\n scalingo addon-plans scalingo-mongodb",
Usage: "List plans",
Action: func(c *cli.Context) {
if len(c.Args()) != 1 {
Action: func(c *cli.Context) error {
if c.Args().Len() != 1 {
cli.ShowCommandHelp(c, "addons-plans")
return
return nil
}
if err := addon_providers.Plans(c.Args()[0]); err != nil {
if err := addon_providers.Plans(c.Args().First()); err != nil {
errorQuit(err)
}
return nil
},
BashComplete: func(c *cli.Context) {
autocomplete.AddonsPlansAutoComplete(c)
Expand Down
Loading