MCPcopy Create free account
hub / github.com/chip/pathos / saveShellSource

Function saveShellSource

pathos.go:171–192  ·  view source on GitHub ↗
(m model)

Source from the content-addressed store, hash-verified

169}
170
171func saveShellSource(m model) (int, error) {
172 s := []string{}
173 for _, listItem := range m.list.Items() {
174 i, _ := listItem.(item)
175 path := string(i)
176 if path != "" {
177 s = append(s, path)
178 }
179 }
180 data := "export PATH=" + strings.Join(s, ":")
181
182 HOME := os.Getenv("HOME")
183 filename := HOME + "/pathos.sh"
184
185 file, err := os.Create(filename)
186 if err != nil {
187 return -1, err
188 }
189 defer file.Close()
190
191 return file.WriteString(data)
192}
193
194func (m model) Init() tea.Cmd {
195 return tea.EnterAltScreen

Callers 1

UpdateMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected