From b66d65379faba6635690cd9313fd43b60a69a59b Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 22 Jul 2021 11:07:23 +0100 Subject: [PATCH 1/2] cmd/ghcs/*.go: Better short descriptions of what commands do MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 ``` --- cmd/ghcs/code.go | 3 +-- cmd/ghcs/create.go | 3 +-- cmd/ghcs/delete.go | 3 +-- cmd/ghcs/list.go | 3 +-- cmd/ghcs/ports.go | 3 +-- cmd/ghcs/ssh.go | 3 +-- 6 files changed, 6 insertions(+), 12 deletions(-) diff --git a/cmd/ghcs/code.go b/cmd/ghcs/code.go index 1080fd896..ccb4788ee 100644 --- a/cmd/ghcs/code.go +++ b/cmd/ghcs/code.go @@ -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 { diff --git a/cmd/ghcs/create.go b/cmd/ghcs/create.go index 44bedb5f2..b179b5dba 100644 --- a/cmd/ghcs/create.go +++ b/cmd/ghcs/create.go @@ -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() }, diff --git a/cmd/ghcs/delete.go b/cmd/ghcs/delete.go index a24374a4c..0f274e987 100644 --- a/cmd/ghcs/delete.go +++ b/cmd/ghcs/delete.go @@ -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.") diff --git a/cmd/ghcs/list.go b/cmd/ghcs/list.go index e02e6a1d2..6db79af97 100644 --- a/cmd/ghcs/list.go +++ b/cmd/ghcs/list.go @@ -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() }, diff --git a/cmd/ghcs/ports.go b/cmd/ghcs/ports.go index d5b863c82..6d2086088 100644 --- a/cmd/ghcs/ports.go +++ b/cmd/ghcs/ports.go @@ -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() }, diff --git a/cmd/ghcs/ssh.go b/cmd/ghcs/ssh.go index 6c4385aaf..89aa77c1b 100644 --- a/cmd/ghcs/ssh.go +++ b/cmd/ghcs/ssh.go @@ -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) }, From 69865fa7623bc0a857dc8a1f4140d3c4567785a7 Mon Sep 17 00:00:00 2001 From: Issy Long Date: Thu, 22 Jul 2021 14:08:20 +0100 Subject: [PATCH 2/2] cmd/ghcs/main: Better description of `ghcs` as a whole Co-authored-by: Camilo Garcia La Rotta --- cmd/ghcs/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/ghcs/main.go b/cmd/ghcs/main.go index 696975ab5..a89a544b4 100644 --- a/cmd/ghcs/main.go +++ b/cmd/ghcs/main.go @@ -13,8 +13,8 @@ func main() { var rootCmd = &cobra.Command{ Use: "ghcs", - Short: "Codespaces", - Long: "Codespaces", + Short: "Unofficial GitHub Codespaces CLI.", + Long: "Unofficial CLI tool to manage and interact with GitHub Codespaces.", Version: "0.6.0", }