Skip to content

Commit

Permalink
Command tidy up name->command
Browse files Browse the repository at this point in the history
  • Loading branch information
codepope committed Jul 6, 2020
1 parent b65f7b1 commit 278b07b
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 40 deletions.
2 changes: 1 addition & 1 deletion cmd/apps.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/superfly/flyctl/docstrings"
)

func newAppListCommand() *Command {
func newAppsCommand() *Command {

appsStrings := docstrings.Get("apps")

Expand Down
9 changes: 5 additions & 4 deletions cmd/history.go
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
package cmd

import (
"github.com/superfly/flyctl/cmdctx"
"os"

"github.com/superfly/flyctl/cmdctx"

"github.com/superfly/flyctl/docstrings"

"github.com/superfly/flyctl/cmd/presenters"
)

func newAppHistoryCommand() *Command {
func newHistoryCommand() *Command {
historyStrings := docstrings.Get("history")
return BuildCommand(nil, runAppHistory, historyStrings.Usage, historyStrings.Short, historyStrings.Long, os.Stdout, requireSession, requireAppName)
return BuildCommand(nil, runHistory, historyStrings.Usage, historyStrings.Short, historyStrings.Long, os.Stdout, requireSession, requireAppName)
}

func runAppHistory(commandContext *cmdctx.CmdContext) error {
func runHistory(commandContext *cmdctx.CmdContext) error {
changes, err := commandContext.Client.API().GetAppChanges(commandContext.AppName)
if err != nil {
return err
Expand Down
6 changes: 3 additions & 3 deletions cmd/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ import (
"github.com/superfly/flyctl/cmd/presenters"
)

func newAppInfoCommand() *Command {
func newInfoCommand() *Command {
ks := docstrings.Get("info")
appInfoCmd := BuildCommand(nil, runAppInfo, ks.Usage, ks.Short, ks.Long, os.Stdout, requireSession, requireAppName)
appInfoCmd := BuildCommand(nil, runInfo, ks.Usage, ks.Short, ks.Long, os.Stdout, requireSession, requireAppName)

appInfoCmd.AddBoolFlag(BoolFlagOpts{
Name: "name",
Expand All @@ -27,7 +27,7 @@ func newAppInfoCommand() *Command {
return appInfoCmd
}

func runAppInfo(ctx *cmdctx.CmdContext) error {
func runInfo(ctx *cmdctx.CmdContext) error {
app, err := ctx.Client.API().GetAppCompact(ctx.AppName)
if err != nil {
return err
Expand Down
7 changes: 4 additions & 3 deletions cmd/logs.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
package cmd

import (
"github.com/superfly/flyctl/cmd/presenters"
"github.com/superfly/flyctl/cmdctx"
"math"
"os"
"time"

"github.com/superfly/flyctl/cmd/presenters"
"github.com/superfly/flyctl/cmdctx"

"github.com/superfly/flyctl/docstrings"

"github.com/superfly/flyctl/api"
"github.com/superfly/flyctl/terminal"
)

func newAppLogsCommand() *Command {
func newLogsCommand() *Command {
logsStrings := docstrings.Get("logs")
cmd := BuildCommand(nil, runLogs, logsStrings.Usage, logsStrings.Short, logsStrings.Long, os.Stdout, requireSession, requireAppName)

Expand Down
9 changes: 5 additions & 4 deletions cmd/releases.go
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
package cmd

import (
"github.com/superfly/flyctl/cmdctx"
"os"

"github.com/superfly/flyctl/cmdctx"

"github.com/superfly/flyctl/docstrings"

"github.com/superfly/flyctl/cmd/presenters"
)

func newAppReleasesListCommand() *Command {
func newReleasesCommand() *Command {
releasesStrings := docstrings.Get("releases")
cmd := BuildCommand(nil, runAppReleasesList, releasesStrings.Usage, releasesStrings.Short, releasesStrings.Long, os.Stdout, requireSession, requireAppName)
cmd := BuildCommand(nil, runReleases, releasesStrings.Usage, releasesStrings.Short, releasesStrings.Long, os.Stdout, requireSession, requireAppName)
return cmd
}

func runAppReleasesList(ctx *cmdctx.CmdContext) error {
func runReleases(ctx *cmdctx.CmdContext) error {
releases, err := ctx.Client.API().GetAppReleases(ctx.AppName, 25)
if err != nil {
return err
Expand Down
42 changes: 21 additions & 21 deletions cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,35 +62,35 @@ func init() {
rootCmd.PersistentFlags().MarkHidden("gqlerrorlogging")

rootCmd.AddCommand(
newAppsCommand(),
newAuthCommand(),
newAppStatusCommand(),
newAppListCommand(),
newAppReleasesListCommand(),
newAppLogsCommand(),
newAppSecretsCommand(),
newVersionCommand(),
newDeployCommand(),
newAppInfoCommand(),
newBuildsCommand(),
newAppHistoryCommand(),
newCurlCommand(),
newCertificatesCommand(),
newConfigCommand(),
newDashboardCommand(),
newDeployCommand(),
newDestroyCommand(),
newDocsCommand(),
newHistoryCommand(),
newInfoCommand(),
newInitCommand(),
newIPAddressesCommand(),
newConfigCommand(),
newScaleCommand(),
newListCommand(),
newLogsCommand(),
newMonitorCommand(),
newMoveCommand(),
newOpenCommand(),
newPlatformCommand(),
newCurlCommand(),
newRegionsCommand(),
newOpenCommand(),
newMonitorCommand(),
newListCommand(),
newDashboardCommand(),
newInitCommand(),
newDestroyCommand(),
newSuspendCommand(),
newResumeCommand(),
newReleasesCommand(),
newRestartCommand(),
newMoveCommand(),
newResumeCommand(),
newScaleCommand(),
newSecretsCommand(),
newStatusCommand(),
newSuspendCommand(),
newVersionCommand(),
)

initConfig()
Expand Down
2 changes: 1 addition & 1 deletion cmd/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
"github.com/superfly/flyctl/helpers"
)

func newAppSecretsCommand() *Command {
func newSecretsCommand() *Command {

secretsStrings := docstrings.Get("secrets")
cmd := &Command{
Expand Down
6 changes: 3 additions & 3 deletions cmd/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ import (
"github.com/superfly/flyctl/cmd/presenters"
)

func newAppStatusCommand() *Command {
func newStatusCommand() *Command {
statusStrings := docstrings.Get("status")
cmd := BuildCommand(nil, runAppStatus, statusStrings.Usage, statusStrings.Short, statusStrings.Long, os.Stdout, requireSession, requireAppName)
cmd := BuildCommand(nil, runStatus, statusStrings.Usage, statusStrings.Short, statusStrings.Long, os.Stdout, requireSession, requireAppName)

//TODO: Move flag descriptions to docstrings
cmd.AddBoolFlag(BoolFlagOpts{Name: "all", Description: "Show completed allocations"})
Expand All @@ -29,7 +29,7 @@ func newAppStatusCommand() *Command {
return cmd
}

func runAppStatus(ctx *cmdctx.CmdContext) error {
func runStatus(ctx *cmdctx.CmdContext) error {
app, err := ctx.Client.API().GetAppStatus(ctx.AppName, ctx.Config.GetBool("all"))
if err != nil {
return err
Expand Down

0 comments on commit 278b07b

Please sign in to comment.