MCPcopy Create free account
hub / github.com/dim-an/cod / GetPreamble

Method GetPreamble

shells/shells.go:150–180  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

148}
149
150func (f *Fish) GetPreamble() (lines []string) {
151 lines = []string{
152 fmt.Sprintf("set -g __COD_BINARY %v", quoteArg(f.codCommandPath)),
153 `
154function __cod_complete_fish
155 set -l words (commandline --current-process --tokenize --cut-at-cursor)
156 set -l cword (count $words)
157 set -l words $words (commandline --current-token --cut-at-cursor)
158 set -l compreply (command $__COD_BINARY api complete-words -- %self "$cword" $words)
159 for entry in $compreply
160 echo $entry
161 end
162 return 0
163end
164
165function __fish_cod_get_completions
166end
167
168function __cod_postexec_fish --on-event fish_postexec
169 set -l cmd "$argv[1]"
170 if test -n "$cmd" -a "$status" -eq 0
171 command $__COD_BINARY api postexec -- %self "$cmd"
172 end
173 command $__COD_BINARY api poll-updates -- %self | source
174end
175
176cod api attach -- %self fish
177`,
178 }
179 return
180}
181
182//
183// Bash

Callers

nothing calls this directly

Calls 1

quoteArgFunction · 0.85

Tested by

no test coverage detected