MCPcopy
hub / github.com/docker/docker-agent / handleAttachFile

Method handleAttachFile

pkg/tui/handlers.go:799–818  ·  view source on GitHub ↗
(filePath string)

Source from the content-addressed store, hash-verified

797}
798
799func (m *appModel) handleAttachFile(filePath string) (tea.Model, tea.Cmd) {
800 if filePath != "" {
801 if err := m.editor.AttachFile(filePath); err != nil {
802 slog.Warn("failed to attach file", "path", filePath, "error", err)
803 // Attachment failed — open the file picker with an error notification
804 return m, tea.Batch(
805 notification.ErrorCmd("Failed to attach "+filePath),
806 core.CmdHandler(dialog.OpenDialogMsg{
807 Model: dialog.NewFilePickerDialog(filePath),
808 }),
809 )
810 }
811 return m, notification.SuccessCmd("File attached: " + filePath)
812 }
813
814 // No path provided — open the file picker dialog
815 return m, core.CmdHandler(dialog.OpenDialogMsg{
816 Model: dialog.NewFilePickerDialog(filePath),
817 })
818}
819
820// --- Speech-to-text ---
821

Callers 1

updateMethod · 0.95

Calls 7

ErrorCmdFunction · 0.92
CmdHandlerFunction · 0.92
NewFilePickerDialogFunction · 0.92
SuccessCmdFunction · 0.92
WarnMethod · 0.80
BatchMethod · 0.80
AttachFileMethod · 0.65

Tested by

no test coverage detected