feat(hook): write marked profile blocks and register zsh completion

`netssh hook install` and the setup wizard now write the same marked
`# >>> netssh >>>` block as install.sh and replace unmarked entries of
older versions instead of appending duplicates. Uninstall shares the
legacy patterns with the installer (eval/alias/source variants).

For zsh the block adds ~/.zfunc to fpath and calls compdef, so
completion also works when compinit already ran earlier in .zshrc,
e.g. with oh-my-zsh. The installer reports which completion it set up
per shell and how to reset ~/.zcompdump.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Sebastian UnterschützandClaude Opus 5.5 committed 2026-10-28 11:22:53 +01:00
1 parent 8fb7633783
commit 129a7201bc
6 files changed
+221 -55

No files matched your search

+7
View File
@@ -108,7 +108,14 @@ func TestInstallerUpdatesAndConsolidatesProfilesWithoutPython(t *testing.T) {
t.Fatalf("bad managed blocks: %s", data)
}
}
zshrc, _ := os.ReadFile(filepath.Join(f.home, ".zshrc"))
if !strings.Contains(string(zshrc), "compdef _netssh netssh") || !strings.Contains(string(zshrc), "/.zfunc' $fpath)") {
t.Fatalf("zsh completion not registered: %s", zshrc)
}
data, _ := os.ReadFile(bashrc)
if strings.Contains(string(data), "compdef") {
t.Fatalf("zsh code in bash profile: %s", data)
}
for _, kept := range []string{"export KEEP=yes", "# netssh shell-init is documented here", "echo 'netssh shell-init'"} {
if !strings.Contains(string(data), kept) {
t.Fatalf("unrelated line lost: %s", kept)