@@ -17,15 +17,16 @@ var configCmd = &cobra.Command{
1717Configuration is stored in ~/.config/tusk/cli.json
1818
1919Available configuration keys:
20- analytics Enable or disable usage analytics (true/false)
21- darkMode Dark mode for terminal output (true/false)
20+ analytics Enable or disable usage analytics (true/false)
21+ darkMode Dark mode for terminal output (true/false)
22+ autoUpdate Automatically update without prompting (true/false)
23+ autoCheckUpdates Check for updates on startup (true/false, default: true)
2224
2325Examples:
24- tusk config get analytics # Show current analytics setting
25- tusk config set analytics false # Disable analytics
26- tusk config get darkMode # Show current dark mode setting
27- tusk config set darkMode true # Enable dark mode
28- tusk config set darkMode false # Disable dark mode` ,
26+ tusk config get analytics # Show current analytics setting
27+ tusk config set analytics false # Disable analytics
28+ tusk config set autoUpdate true # Enable automatic updates
29+ tusk config set autoCheckUpdates false # Disable update checking` ,
2930 Run : func (cmd * cobra.Command , args []string ) {
3031 _ = cmd .Help ()
3132 },
@@ -37,8 +38,10 @@ var configGetCmd = &cobra.Command{
3738 Long : `Get the current value of a configuration key.
3839
3940Available keys:
40- analytics Usage analytics setting
41- darkMode Dark mode setting` ,
41+ analytics Usage analytics setting
42+ darkMode Dark mode setting
43+ autoUpdate Automatic update setting
44+ autoCheckUpdates Update checking setting` ,
4245 Args : cobra .ExactArgs (1 ),
4346 RunE : func (cmd * cobra.Command , args []string ) error {
4447 key := args [0 ]
@@ -53,8 +56,17 @@ Available keys:
5356 } else {
5457 fmt .Println ("unset" )
5558 }
59+ case "autoupdate" :
60+ fmt .Println (cfg .AutoUpdate )
61+ case "autocheckupdates" :
62+ // nil means true (default)
63+ if cfg .AutoCheckUpdates != nil {
64+ fmt .Println (* cfg .AutoCheckUpdates )
65+ } else {
66+ fmt .Println (true )
67+ }
5668 default :
57- return fmt .Errorf ("unknown config key: %s\n \n Available keys: analytics, darkMode" , key )
69+ return fmt .Errorf ("unknown config key: %s\n \n Available keys: analytics, darkMode, autoUpdate, autoCheckUpdates " , key )
5870 }
5971
6072 return nil
@@ -67,12 +79,14 @@ var configSetCmd = &cobra.Command{
6779 Long : `Set the value of a configuration key.
6880
6981Available keys and values:
70- analytics true/false Enable or disable usage analytics
71- darkMode true/false Dark mode for terminal output
82+ analytics true/false Enable or disable usage analytics
83+ darkMode true/false Dark mode for terminal output
84+ autoUpdate true/false Automatically update without prompting
85+ autoCheckUpdates true/false Check for updates on startup (default: true)
7286
7387Examples:
7488 tusk config set analytics false
75- tusk config set darkMode true` ,
89+ tusk config set autoUpdate true` ,
7690 Args : cobra .ExactArgs (2 ),
7791 RunE : func (cmd * cobra.Command , args []string ) error {
7892 key := args [0 ]
@@ -96,8 +110,20 @@ Examples:
96110 return fmt .Errorf ("invalid value for darkMode: %s (expected true/false)" , value )
97111 }
98112 cfg .DarkMode = & boolVal
113+ case "autoupdate" :
114+ boolVal , err := parseBool (value )
115+ if err != nil {
116+ return fmt .Errorf ("invalid value for autoUpdate: %s (expected true/false)" , value )
117+ }
118+ cfg .AutoUpdate = boolVal
119+ case "autocheckupdates" :
120+ boolVal , err := parseBool (value )
121+ if err != nil {
122+ return fmt .Errorf ("invalid value for autoCheckUpdates: %s (expected true/false)" , value )
123+ }
124+ cfg .AutoCheckUpdates = & boolVal
99125 default :
100- return fmt .Errorf ("unknown config key: %s\n \n Available keys: analytics, darkMode" , key )
126+ return fmt .Errorf ("unknown config key: %s\n \n Available keys: analytics, darkMode, autoUpdate, autoCheckUpdates " , key )
101127 }
102128
103129 if err := cfg .Save (); err != nil {
0 commit comments