Skip to content

Commit 2df470c

Browse files
committed
docs: add comments explaining the purpose and behavior of config commands
- Add a comment explaining the purpose of the `configCmd` command - Add a comment explaining the purpose of the `configListCmd` command - Add a comment explaining the purpose of the `configSetCmd` command - Add a comment explaining the behavior of the `configListCmd` command Signed-off-by: appleboy <appleboy.tw@gmail.com>
1 parent d24af1a commit 2df470c

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

cmd/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import (
44
"github.com/spf13/cobra"
55
)
66

7+
// configCmd represents the command for custom configuration,
8+
// including openai.api_key and openai.model and etc...
79
var configCmd = &cobra.Command{
810
Use: "config",
911
Short: "custom config (openai.api_key, openai.model ...)",

cmd/config_list.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@ var availableKeys = map[string]string{
3939
"openai.presence_penalty": "Number between 0.0 and 1.0 that penalizes new tokens based on whether they appear in the text so far. Increases the model's likelihood to talk about new topics.",
4040
}
4141

42-
// configListCmd represents the config list command
42+
// configListCmd represents the command to list the configuration values.
43+
// It creates a table with the header "Key" and "Value" and adds the configuration keys and values to the table.
44+
// The api key is hidden for security purposes.
45+
// Finally, it prints the table.
4346
var configListCmd = &cobra.Command{
4447
Use: "list",
4548
Short: "show the config list",

cmd/config_set.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,11 @@ func init() {
1313
configCmd.AddCommand(configSetCmd)
1414
}
1515

16-
// configSetCmd represents the config set command
16+
// configSetCmd updates the config value.
17+
// It takes at least two arguments, the first one being the key and the second one being the value.
18+
// If the key is not available, it returns an error message.
19+
// If the key is "git.exclude_list", it sets the value as a slice of strings.
20+
// It writes the config to file and prints a success message with the config file location.
1721
var configSetCmd = &cobra.Command{
1822
Use: "set",
1923
Short: "update the config value",

0 commit comments

Comments
 (0)