From 03a68ad5a2a4f1425fa2731b958a2e3a1e1a950a Mon Sep 17 00:00:00 2001 From: David Dworken Date: Sun, 11 Aug 2024 11:40:15 -0700 Subject: [PATCH] Change compact-mode setting that was added in #237 to respect the convention of taking in an argument --- client/cmd/configSet.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/client/cmd/configSet.go b/client/cmd/configSet.go index 5958529..7805da9 100644 --- a/client/cmd/configSet.go +++ b/client/cmd/configSet.go @@ -210,14 +210,15 @@ var setColorSchemeBorderColor = &cobra.Command{ }, } -var toggleCompactMode = &cobra.Command{ - Use: "toggle-compact-mode", - Short: "Toggle compact mode switching it on or off", - Args: cobra.ExactArgs(0), +var compactMode = &cobra.Command{ + Use: "compact-mode", + Short: "Configure whether the TUI should run in compact mode to minimize wasted terminal space", + Args: cobra.MatchAll(cobra.ExactArgs(1), cobra.OnlyValidArgs), + ValidArgs: []string{"true", "false"}, Run: func(cmd *cobra.Command, args []string) { ctx := hctx.MakeContext() config := hctx.GetConf(ctx) - config.ForceCompactMode = !config.ForceCompactMode + config.ForceCompactMode = args[0] == "true" lib.CheckFatalError(hctx.SetConfig(config)) }, } @@ -254,7 +255,7 @@ func init() { configSetCmd.AddCommand(setColorSchemeCmd) configSetCmd.AddCommand(setDefaultFilterCommand) configSetCmd.AddCommand(setAiCompletionEndpoint) - configSetCmd.AddCommand(toggleCompactMode) + configSetCmd.AddCommand(compactMode) setColorSchemeCmd.AddCommand(setColorSchemeSelectedText) setColorSchemeCmd.AddCommand(setColorSchemeSelectedBackground) setColorSchemeCmd.AddCommand(setColorSchemeBorderColor)