From c6c366e8f50d5ccadf11db52e1c033c82ff1e843 Mon Sep 17 00:00:00 2001 From: micnncim Date: Thu, 11 Jun 2020 19:53:09 +0900 Subject: [PATCH 1/3] Fix gh config examples in documentations --- command/config.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/command/config.go b/command/config.go index 7e2a541f7..a896016a8 100644 --- a/command/config.go +++ b/command/config.go @@ -36,6 +36,7 @@ var configGetCmd = &cobra.Command{ Long: `Get the value for a given configuration key. Examples: + $ gh config get git_protocol https `, @@ -49,6 +50,7 @@ var configSetCmd = &cobra.Command{ Long: `Update the configuration by setting a key to a value. Examples: + $ gh config set editor vim `, Args: cobra.ExactArgs(2), From 8e90c27c460d1ca4c296488cd20374f229786d3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Thu, 11 Jun 2020 16:44:08 +0200 Subject: [PATCH 2/3] Use Cobra's `Example` field for `config get/set` examples --- command/config.go | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/command/config.go b/command/config.go index a896016a8..a4511061e 100644 --- a/command/config.go +++ b/command/config.go @@ -32,13 +32,10 @@ Current respected settings: var configGetCmd = &cobra.Command{ Use: "get ", - Short: "Prints the value of a given configuration key", - Long: `Get the value for a given configuration key. - -Examples: - - $ gh config get git_protocol - https + Short: "Print the value of a given configuration key", + Example: ` + $ gh config get git_protocol + https `, Args: cobra.ExactArgs(1), RunE: configGet, @@ -46,12 +43,9 @@ Examples: var configSetCmd = &cobra.Command{ Use: "set ", - Short: "Updates configuration with the value of a given key", - Long: `Update the configuration by setting a key to a value. - -Examples: - - $ gh config set editor vim + Short: "Update configuration with a value for the given key", + Example: ` + $ gh config set editor vim `, Args: cobra.ExactArgs(2), RunE: configSet, From e7c934b05c89875de28024a0ab8a2d74c35d0ca1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mislav=20Marohni=C4=87?= Date: Thu, 11 Jun 2020 16:44:27 +0200 Subject: [PATCH 3/3] Tweak `gh help config` output --- command/config.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/command/config.go b/command/config.go index a4511061e..e27580bd9 100644 --- a/command/config.go +++ b/command/config.go @@ -2,6 +2,7 @@ package command import ( "fmt" + "github.com/spf13/cobra" ) @@ -21,11 +22,11 @@ func init() { var configCmd = &cobra.Command{ Use: "config", - Short: "Set and get gh settings", - Long: `Get and set key/value strings. + Short: "Manage configuration for gh", + Long: `Display or change configuration settings for gh. Current respected settings: -- git_protocol: https or ssh. Default is https. +- git_protocol: "https" or "ssh". Default is "https". - editor: if unset, defaults to environment variables. `, }