This commit is contained in:
1 parent
14d519d010
commit
34503de68e
7 files changed
+319
-1
No files matched your search
@@ -388,7 +388,17 @@ func completionInstallCmd(root *cobra.Command) *cobra.Command {
|
||||
if err := os.WriteFile(file, script, 0o644); err != nil {
|
||||
return fmt.Errorf("writing %s: %w", file, err)
|
||||
}
|
||||
cfg, err := config.Load()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err := hook.SyncCommandCompletion(cfg.Shell.Alias); err != nil {
|
||||
return err
|
||||
}
|
||||
fmt.Printf("Completion installed → %s\n%s\n", file, note)
|
||||
if cfg.Shell.Alias != "" {
|
||||
fmt.Printf("Completion also enabled for alias %q.\n", cfg.Shell.Alias)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ func TestLocalNotesCLI(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestShellInitUpdatesAndRemovesCommandAliasWithoutHosts(t *testing.T) {
|
||||
t.Setenv("HOME", t.TempDir())
|
||||
t.Setenv("XDG_CONFIG_HOME", t.TempDir())
|
||||
t.Setenv("XDG_CACHE_HOME", t.TempDir())
|
||||
t.Setenv("NETSSH_CACHE_PATH", filepath.Join(t.TempDir(), "hosts.json"))
|
||||
|
||||
Reference in new issue
Block a user