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

Remove unused commands from CLI #345

Merged
merged 12 commits into from
Nov 27, 2023
28 changes: 2 additions & 26 deletions cmd/connect-client/commands/accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,13 @@ package commands

import (
"fmt"
"net/url"
"os"
"time"

"github.com/rstudio/connect-client/internal/accounts"
"github.com/rstudio/connect-client/internal/api_client/clients"
"github.com/rstudio/connect-client/internal/cli_types"
)

type addAccountCmd struct {
Name string `short:"n" help:"Nickname for the account."`
URL *url.URL `short:"u" help:"Server URL."`
APIKey string `short:"k" help:"API key."`
Certificate *os.File `help:"Path to CA certificate bundle."`
Insecure bool `help:"Don't validate server certificate."`
}

func (cmd *addAccountCmd) Run(args *cli_types.CommonArgs) error {
return nil
}

type removeAccountCmd struct {
Name string `short:"n" help:"Nickname of account to remove."`
}

func (cmd *removeAccountCmd) Run(args *cli_types.CommonArgs) error {
return nil
}

type testAccountCmd struct {
Name string `short:"n" help:"Nickname of account to test."`
}
Expand Down Expand Up @@ -101,8 +79,6 @@ func (cmd *listAccountsCmd) Run(args *cli_types.CommonArgs, ctx *cli_types.CLICo
}

type AccountCommands struct {
AddAccount addAccountCmd `kong:"cmd" help:"Add a publishing account."`
RemoveAccount removeAccountCmd `kong:"cmd" help:"Remove a publishing account. Specify by name or URL."`
ListAccounts listAccountsCmd `kong:"cmd" help:"List publishing accounts."`
TestAccount testAccountCmd `kong:"cmd" help:"Verify connectivity and credentials for a publishing account."`
ListAccounts listAccountsCmd `kong:"cmd" help:"List publishing accounts."`
TestAccount testAccountCmd `kong:"cmd" help:"Verify connectivity and credentials for a publishing account."`
}
27 changes: 0 additions & 27 deletions cmd/connect-client/commands/publish.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,33 +250,6 @@ func (cmd *BaseBundleCmd) inspectPython(log logging.Logger, manifest *bundles.Ma
return nil
}

type CreateBundleCmd struct {
*BaseBundleCmd `kong:"embed"`
BundleFile util.Path `help:"Path to a file where the bundle should be written." kong:"required"`
}

func (cmd *CreateBundleCmd) Run(args *cli_types.CommonArgs, ctx *cli_types.CLIContext) error {
err := cmd.stateFromCLI(ctx.Logger)
if err != nil {
return err
}
publisher := publish.New(&cmd.PublishArgs)
return publisher.CreateBundleFromDirectory(cmd.BundleFile, ctx.Logger)
}

type WriteManifestCmd struct {
*BaseBundleCmd `kong:"embed"`
}

func (cmd *WriteManifestCmd) Run(args *cli_types.CommonArgs, ctx *cli_types.CLIContext) error {
err := cmd.stateFromCLI(ctx.Logger)
if err != nil {
return err
}
publisher := publish.New(&cmd.PublishArgs)
return publisher.WriteManifestFromDirectory(ctx.Logger)
}

type PublishCmd struct {
*BaseBundleCmd `kong:"embed"`
}
Expand Down
8 changes: 3 additions & 5 deletions cmd/connect-client/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ type cliSpec struct {
cli_types.CommonArgs
commands.AccountCommands `group:"Accounts"`

Publish commands.PublishCmd `kong:"cmd" help:"Publish a project."`
PublishUI commands.PublishUICmd `kong:"cmd" help:"Publish a project using the UI."`
CreateBundle commands.CreateBundleCmd `kong:"cmd" help:"Create a bundle file for a project directory."`
WriteManifest commands.WriteManifestCmd `kong:"cmd" help:"Create a manifest.json file for a project directory."`
Version commands.VersionFlag `help:"Show the client software version and exit."`
Publish commands.PublishCmd `kong:"cmd" help:"Publish a project."`
PublishUI commands.PublishUICmd `kong:"cmd" help:"Publish a project using the UI."`
Version commands.VersionFlag `help:"Show the client software version and exit."`
}

func logVersion(log logging.Logger) {
Expand Down