cmd/ghcs/*.go: Better short descriptions of what commands do

- I ran `--help` on `ghcs code` and saw `ghcs code` and that was it,
  which was surprising. I expected a description.
- Here's a fix for all of the commands thus far to give them longer
  descriptions.
- I've only done "short" descriptions in Cobra terms, and removed the
  "long" descriptions as they seemed like they needed to be
  unnecessarily verbose.

Before:

```
❯ ghcs --help
Codespaces

Usage:
  ghcs [command]

Available Commands:
  code        code
  create      Create
  delete      delete
  help        Help about any command
  list        list
  ports       ports
  ssh         ssh

Flags:
  -h, --help      help for ghcs
  -v, --version   version for ghcs

Use "ghcs [command] --help" for more information about a command.

❯ ghcs ssh --help
ssh

Usage:
  ghcs ssh [flags]

Flags:
  -h, --help              help for ssh
      --profile string    SSH Profile
      --server-port int   SSH Server Port
```

After:

```
❯ ./ghcs --help
Codespaces

Usage:
  ghcs [command]

Available Commands:
  code        Open a GitHub Codespace in VSCode.
  create      Create a GitHub Codespace.
  delete      Delete a GitHub Codespace.
  help        Help about any command
  list        List GitHub Codespaces you have on your account.
  ports       Forward ports from a GitHub Codespace.
  ssh         SSH into a GitHub Codespace, for use with running tests/editing in vim, etc.

Flags:
  -h, --help      help for ghcs
  -v, --version   version for ghcs

Use "ghcs [command] --help" for more information about a command.

❯ ./ghcs ssh --help
SSH into a GitHub Codespace, for use with running tests/editing in vim, etc.

Usage:
  ghcs ssh [flags]

Flags:
  -h, --help              help for ssh
      --profile string    SSH Profile
      --server-port int   SSH Server Port
```
This commit is contained in:
Issy Long 2021-07-22 11:07:23 +01:00
parent 35f458b853
commit b66d65379f
6 changed files with 6 additions and 12 deletions

View file

@ -15,8 +15,7 @@ import (
func NewCodeCmd() *cobra.Command {
return &cobra.Command{
Use: "code",
Short: "code",
Long: "code",
Short: "Open a GitHub Codespace in VSCode.",
RunE: func(cmd *cobra.Command, args []string) error {
var codespaceName string
if len(args) > 0 {

View file

@ -14,8 +14,7 @@ import (
var createCmd = &cobra.Command{
Use: "create",
Short: "Create",
Long: "Create",
Short: "Create a GitHub Codespace.",
RunE: func(cmd *cobra.Command, args []string) error {
return Create()
},

View file

@ -13,8 +13,7 @@ import (
func NewDeleteCmd() *cobra.Command {
deleteCmd := &cobra.Command{
Use: "delete CODESPACE_NAME",
Short: "delete",
Long: "delete",
Short: "Delete a GitHub Codespace.",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) == 0 {
return errors.New("A Codespace name is required.")

View file

@ -14,8 +14,7 @@ import (
func NewListCmd() *cobra.Command {
listCmd := &cobra.Command{
Use: "list",
Short: "list",
Long: "list",
Short: "List GitHub Codespaces you have on your account.",
RunE: func(cmd *cobra.Command, args []string) error {
return List()
},

View file

@ -20,8 +20,7 @@ import (
func NewPortsCmd() *cobra.Command {
portsCmd := &cobra.Command{
Use: "ports",
Short: "ports",
Long: "ports",
Short: "Forward ports from a GitHub Codespace.",
RunE: func(cmd *cobra.Command, args []string) error {
return Ports()
},

View file

@ -23,8 +23,7 @@ func NewSSHCmd() *cobra.Command {
sshCmd := &cobra.Command{
Use: "ssh",
Short: "ssh",
Long: "ssh",
Short: "SSH into a GitHub Codespace, for use with running tests/editing in vim, etc.",
RunE: func(cmd *cobra.Command, args []string) error {
return SSH(sshProfile, sshServerPort)
},