@@ -10,11 +10,11 @@ import (
1010
1111// TestCompletionCommandBash generates bash completion script.
1212func TestCompletionCommandBash (t * testing.T ) {
13- originalConfigDir := defaultCLIContext .ConfigDir ()
14- t .Cleanup (func () { defaultCLIContext .SetConfigDir (originalConfigDir ) })
13+ originalConfigDir := testCLI .ConfigDir ()
14+ t .Cleanup (func () { testCLI .SetConfigDir (originalConfigDir ) })
1515
1616 tmpDir := t .TempDir ()
17- defaultCLIContext .SetConfigDir (tmpDir )
17+ testCLI .SetConfigDir (tmpDir )
1818
1919 buf := new (bytes.Buffer )
2020 rootCmd .SetOut (buf )
@@ -42,11 +42,11 @@ func min(a, b int) int {
4242
4343// TestCompletionCommandZsh generates zsh completion script.
4444func TestCompletionCommandZsh (t * testing.T ) {
45- originalConfigDir := defaultCLIContext .ConfigDir ()
46- t .Cleanup (func () { defaultCLIContext .SetConfigDir (originalConfigDir ) })
45+ originalConfigDir := testCLI .ConfigDir ()
46+ t .Cleanup (func () { testCLI .SetConfigDir (originalConfigDir ) })
4747
4848 tmpDir := t .TempDir ()
49- defaultCLIContext .SetConfigDir (tmpDir )
49+ testCLI .SetConfigDir (tmpDir )
5050
5151 buf := new (bytes.Buffer )
5252 rootCmd .SetOut (buf )
@@ -67,11 +67,11 @@ func TestCompletionCommandZsh(t *testing.T) {
6767
6868// TestCompletionCommandFish generates fish completion script.
6969func TestCompletionCommandFish (t * testing.T ) {
70- originalConfigDir := defaultCLIContext .ConfigDir ()
71- t .Cleanup (func () { defaultCLIContext .SetConfigDir (originalConfigDir ) })
70+ originalConfigDir := testCLI .ConfigDir ()
71+ t .Cleanup (func () { testCLI .SetConfigDir (originalConfigDir ) })
7272
7373 tmpDir := t .TempDir ()
74- defaultCLIContext .SetConfigDir (tmpDir )
74+ testCLI .SetConfigDir (tmpDir )
7575
7676 buf := new (bytes.Buffer )
7777 rootCmd .SetOut (buf )
@@ -92,11 +92,11 @@ func TestCompletionCommandFish(t *testing.T) {
9292
9393// TestCompletionCommandPowerShell generates PowerShell completion script.
9494func TestCompletionCommandPowerShell (t * testing.T ) {
95- originalConfigDir := defaultCLIContext .ConfigDir ()
96- t .Cleanup (func () { defaultCLIContext .SetConfigDir (originalConfigDir ) })
95+ originalConfigDir := testCLI .ConfigDir ()
96+ t .Cleanup (func () { testCLI .SetConfigDir (originalConfigDir ) })
9797
9898 tmpDir := t .TempDir ()
99- defaultCLIContext .SetConfigDir (tmpDir )
99+ testCLI .SetConfigDir (tmpDir )
100100
101101 buf := new (bytes.Buffer )
102102 rootCmd .SetOut (buf )
@@ -117,11 +117,11 @@ func TestCompletionCommandPowerShell(t *testing.T) {
117117
118118// TestCompletionCommandUnknownShell returns error for unknown shell.
119119func TestCompletionCommandUnknownShell (t * testing.T ) {
120- originalConfigDir := defaultCLIContext .ConfigDir ()
121- t .Cleanup (func () { defaultCLIContext .SetConfigDir (originalConfigDir ) })
120+ originalConfigDir := testCLI .ConfigDir ()
121+ t .Cleanup (func () { testCLI .SetConfigDir (originalConfigDir ) })
122122
123123 tmpDir := t .TempDir ()
124- defaultCLIContext .SetConfigDir (tmpDir )
124+ testCLI .SetConfigDir (tmpDir )
125125
126126 buf := new (bytes.Buffer )
127127 rootCmd .SetOut (buf )
@@ -135,11 +135,11 @@ func TestCompletionCommandUnknownShell(t *testing.T) {
135135
136136// TestCompletionCommandNoArgs shows error when run without shell argument.
137137func TestCompletionCommandNoArgs (t * testing.T ) {
138- originalConfigDir := defaultCLIContext .ConfigDir ()
139- t .Cleanup (func () { defaultCLIContext .SetConfigDir (originalConfigDir ) })
138+ originalConfigDir := testCLI .ConfigDir ()
139+ t .Cleanup (func () { testCLI .SetConfigDir (originalConfigDir ) })
140140
141141 tmpDir := t .TempDir ()
142- defaultCLIContext .SetConfigDir (tmpDir )
142+ testCLI .SetConfigDir (tmpDir )
143143
144144 buf := new (bytes.Buffer )
145145 rootCmd .SetOut (buf )
@@ -153,15 +153,15 @@ func TestCompletionCommandNoArgs(t *testing.T) {
153153
154154// TestCompletionCommandWithOutputFlag saves completion to file.
155155func TestCompletionCommandWithOutputFlag (t * testing.T ) {
156- originalConfigDir := defaultCLIContext .ConfigDir ()
156+ originalConfigDir := testCLI .ConfigDir ()
157157 t .Cleanup (func () {
158- defaultCLIContext .SetConfigDir (originalConfigDir )
158+ testCLI .SetConfigDir (originalConfigDir )
159159 completionOutput = ""
160160 completionSave = false
161161 })
162162
163163 tmpDir := t .TempDir ()
164- defaultCLIContext .SetConfigDir (tmpDir )
164+ testCLI .SetConfigDir (tmpDir )
165165
166166 outputPath := filepath .Join (tmpDir , "kairo-completion.sh" )
167167 rootCmd .SetArgs ([]string {"completion" , "bash" , "--output" , outputPath })
@@ -189,15 +189,15 @@ func TestCompletionCommandWithOutputFlag(t *testing.T) {
189189
190190// TestCompletionCommandWithShortOutputFlag saves to file using -o flag.
191191func TestCompletionCommandWithShortOutputFlag (t * testing.T ) {
192- originalConfigDir := defaultCLIContext .ConfigDir ()
192+ originalConfigDir := testCLI .ConfigDir ()
193193 t .Cleanup (func () {
194- defaultCLIContext .SetConfigDir (originalConfigDir )
194+ testCLI .SetConfigDir (originalConfigDir )
195195 completionOutput = ""
196196 completionSave = false
197197 })
198198
199199 tmpDir := t .TempDir ()
200- defaultCLIContext .SetConfigDir (tmpDir )
200+ testCLI .SetConfigDir (tmpDir )
201201
202202 outputPath := filepath .Join (tmpDir , "kairo-completion.sh" )
203203 rootCmd .SetArgs ([]string {"completion" , "bash" , "-o" , outputPath })
@@ -215,11 +215,11 @@ func TestCompletionCommandWithShortOutputFlag(t *testing.T) {
215215
216216// TestCompletionCommandAutoSaveToDefaultLocation saves completion to default location with --save flag.
217217func TestCompletionCommandAutoSaveToDefaultLocation (t * testing.T ) {
218- originalConfigDir := defaultCLIContext .ConfigDir ()
218+ originalConfigDir := testCLI .ConfigDir ()
219219 originalHome := os .Getenv ("HOME" )
220220 originalUserProfile := os .Getenv ("USERPROFILE" )
221221 t .Cleanup (func () {
222- defaultCLIContext .SetConfigDir (originalConfigDir )
222+ testCLI .SetConfigDir (originalConfigDir )
223223 if originalHome != "" {
224224 os .Setenv ("HOME" , originalHome )
225225 } else {
@@ -235,7 +235,7 @@ func TestCompletionCommandAutoSaveToDefaultLocation(t *testing.T) {
235235 })
236236
237237 tmpDir := t .TempDir ()
238- defaultCLIContext .SetConfigDir (tmpDir )
238+ testCLI .SetConfigDir (tmpDir )
239239
240240 // Set both HOME and USERPROFILE for cross-platform compatibility
241241 os .Setenv ("HOME" , tmpDir )
@@ -376,11 +376,11 @@ func TestGetDefaultCompletionPathNoHomeDir(t *testing.T) {
376376// TestCompletionPowerShellSaveWithRegisterArgumentCompleter verifies that PowerShell
377377// --save flag writes the Register-ArgumentCompleter script instead of cobra's default
378378func TestCompletionPowerShellSaveWithRegisterArgumentCompleter (t * testing.T ) {
379- originalConfigDir := defaultCLIContext .ConfigDir ()
379+ originalConfigDir := testCLI .ConfigDir ()
380380 originalHome := os .Getenv ("HOME" )
381381 originalUserProfile := os .Getenv ("USERPROFILE" )
382382 t .Cleanup (func () {
383- defaultCLIContext .SetConfigDir (originalConfigDir )
383+ testCLI .SetConfigDir (originalConfigDir )
384384 if originalHome != "" {
385385 os .Setenv ("HOME" , originalHome )
386386 } else {
@@ -396,7 +396,7 @@ func TestCompletionPowerShellSaveWithRegisterArgumentCompleter(t *testing.T) {
396396 })
397397
398398 tmpDir := t .TempDir ()
399- defaultCLIContext .SetConfigDir (tmpDir )
399+ testCLI .SetConfigDir (tmpDir )
400400 os .Setenv ("HOME" , tmpDir )
401401 os .Setenv ("USERPROFILE" , tmpDir )
402402
0 commit comments