Skip to content
This repository was archived by the owner on Aug 30, 2024. It is now read-only.

Environment subcommands #89

Closed
wants to merge 14 commits into from
Prev Previous commit
Next Next commit
Rework usage and descriptions
  • Loading branch information
cmoog committed Jul 31, 2020
commit ab278994b81b77073ecd807e65326baa8d9423bf
4 changes: 2 additions & 2 deletions cmd/coder/configssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ func makeConfigSSHCmd() cli.Command {

return cli.Command{
Name: "config-ssh",
UsageText: "",
Description: "add your Coder Enterprise environments to ~/.ssh/config",
Usage: "Configure SSH to access Coder environments",
Description: "Inject the proper OpenSSH configuration into your local SSH config file.",
Action: configSSH(&configpath, &remove),
Flags: []cli.Flag{
cli.StringFlag{
Expand Down
7 changes: 3 additions & 4 deletions cmd/coder/envs.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,13 @@ import (
func makeEnvsCommand() cli.Command {
return cli.Command{
Name: "envs",
UsageText: "",
Description: "interact with Coder environments",
Usage: "Interact with Coder environments",
Description: "Perform operations on the Coder environments owned by the active user.",
Subcommands: []cli.Command{
{
Name: "ls",
Usage: "list all environments owned by the active user",
UsageText: "",
Description: "",
Description: "List all Coder environments owned by the active user.",
ArgsUsage: "[...flags]>",
Action: func(c *cli.Context) {
entClient := requireAuth()
Expand Down
11 changes: 5 additions & 6 deletions cmd/coder/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,12 @@ import (
)

func makeLoginCmd() cli.Command {
cmd := cli.Command{
Name: "login",
Usage: "[Coder Enterprise URL eg. http://my.coder.domain/ ]",
Description: "authenticate this client for future operations",
Action: login,
return cli.Command{
Name: "login",
Usage: "Authenticate this client for future operations",
ArgsUsage: "[Coder Enterprise URL eg. http://my.coder.domain/]",
Action: login,
}
return cmd
}

func login(c *cli.Context) {
Expand Down
7 changes: 3 additions & 4 deletions cmd/coder/logout.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ import (

func makeLogoutCmd() cli.Command {
return cli.Command{
Name: "logout",
//Usage: "",
Description: "remove local authentication credentials (if any)",
Action: logout,
Name: "logout",
Usage: "Remove local authentication credentials if any exist",
Action: logout,
}
}

Expand Down
27 changes: 13 additions & 14 deletions cmd/coder/secrets.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,26 @@ import (
func makeSecretsCmd() cli.Command {
return cli.Command{
Name: "secrets",
Usage: "",
Usage: "Interact with Coder Secrets",
Description: "Interact with secrets objects owned by the active user.",
Subcommands: []cli.Command{
{
Name: "ls",
Usage: "",
Description: "list all secrets owned by the active user",
Action: listSecrets,
Name: "ls",
Usage: "List all secrets owned by the active user",
Action: listSecrets,
},
makeCreateSecret(),
{
Name: "rm",
Usage: "",
Description: "",
Action: removeSecret,
Name: "rm",
Usage: "Remove a secret by name",
ArgsUsage: "[secret_name]",
Action: removeSecret,
},
{
Name: "view",
Usage: "",
Description: "",
Action: viewSecret,
Name: "view",
Usage: "View a secret by name",
ArgsUsage: "[secret_name]",
Action: viewSecret,
},
},
Flags: nil,
Expand All @@ -54,7 +53,7 @@ func makeCreateSecret() cli.Command {

return cli.Command{
Name: "create",
Usage: "create a new secret",
Usage: "Create a new secret",
Description: "Create a new secret object to store application secrets and access them securely from within your environments.",
ArgsUsage: "[secret_name]",
Before: func(c *cli.Context) error {
Expand Down
7 changes: 3 additions & 4 deletions cmd/coder/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ import (
func makeShellCmd() cli.Command {
return cli.Command{
Name: "sh",
Usage: "<env name> [<command [args...]>]",
Description: "execute a remote command on the environment\\nIf no command is specified, the default shell is opened.",
Usage: "Open a shell and execute commands in a Coder environment",
Description: "Execute a remote command on the environment\\nIf no command is specified, the default shell is opened.",
ArgsUsage: "[env_name] [<command [args...]>]",
SkipFlagParsing: true,
SkipArgReorder: true,
UsageText: "",
ArgsUsage: "",
Action: shell,
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/coder/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func makeSyncCmd() cli.Command {
var init bool
return cli.Command{
Name: "sync",
Usage: "synchronize local files to a Coder environment",
Usage: "Synchronize local files to a Coder environment",
Description: "Establish a one way directory sync to a Coder environment.",
ArgsUsage: "[local directory] [<env name>:<remote directory>]",
Before: func(c *cli.Context) error {
Expand Down
19 changes: 5 additions & 14 deletions cmd/coder/users.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,19 @@ import (
func makeUsersCmd() cli.Command {
var output string
return cli.Command{
Name: "users",
ShortName: "",
Aliases: nil,
Usage: "[subcommand] <flags>",
UsageText: "",
Description: "",
ArgsUsage: "",
Action: nil,
OnUsageError: nil,
Name: "users",
Usage: "Interact with Coder user accounts",
ArgsUsage: "[subcommand] <flags>",
Subcommands: []cli.Command{
{
Name: "ls",
Usage: "",
UsageText: "",
Usage: "list all user accounts",
Description: "",
ArgsUsage: "",
Category: "",
Action: listUsers(&output),
Flags: []cli.Flag{
cli.StringFlag{
Name: "output",
Usage: "",
Usage: "(json | human)",
Required: false,
Value: "human",
Destination: &output,
Expand Down