Enable shell completion for configured command aliases
Release / release (push) Successful in 5m8s

This commit is contained in:
Sebastian Unterschütz committed 2026-10-27 19:19:42 +01:00
1 parent 14d519d010
commit 34503de68e
7 files changed
+319 -1

No files matched your search

+10
View File
@@ -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
},
}
+1
View File
@@ -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"))