Some checks failed
Security Scan / security (push) Failing after 25s
- TaskOpenFileWithOptions, TaskSaveFileWithOptions with extended options - TaskInfo, TaskQuestion, TaskWarning, TaskError convenience tasks - OpenFileOptions: CanChooseDirectories, CanChooseFiles, ShowHiddenFiles - 3 new MCP tools: dialog_info, dialog_warning, dialog_error - 29 new tests with Good/Bad/Ugly coverage Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
75 lines
2.9 KiB
Go
75 lines
2.9 KiB
Go
package dialog
|
|
|
|
// TaskOpenFile presents an open-file dialog with the given options.
|
|
//
|
|
// result, _, err := c.PERFORM(dialog.TaskOpenFile{Options: dialog.OpenFileOptions{Title: "Pick file"}})
|
|
// paths := result.([]string)
|
|
type TaskOpenFile struct{ Options OpenFileOptions }
|
|
|
|
// TaskOpenFileWithOptions presents an open-file dialog pre-configured from an options struct.
|
|
// Equivalent to TaskOpenFile but mirrors the stub DialogManager.OpenFileWithOptions API.
|
|
//
|
|
// result, _, err := c.PERFORM(dialog.TaskOpenFileWithOptions{Options: &dialog.OpenFileOptions{Title: "Select log", AllowMultiple: true}})
|
|
type TaskOpenFileWithOptions struct{ Options *OpenFileOptions }
|
|
|
|
// TaskSaveFile presents a save-file dialog with the given options.
|
|
//
|
|
// result, _, err := c.PERFORM(dialog.TaskSaveFile{Options: dialog.SaveFileOptions{Filename: "report.csv"}})
|
|
// path := result.(string)
|
|
type TaskSaveFile struct{ Options SaveFileOptions }
|
|
|
|
// TaskSaveFileWithOptions presents a save-file dialog pre-configured from an options struct.
|
|
// Equivalent to TaskSaveFile but mirrors the stub DialogManager.SaveFileWithOptions API.
|
|
//
|
|
// result, _, err := c.PERFORM(dialog.TaskSaveFileWithOptions{Options: &dialog.SaveFileOptions{Title: "Export data"}})
|
|
type TaskSaveFileWithOptions struct{ Options *SaveFileOptions }
|
|
|
|
// TaskOpenDirectory presents a directory picker dialog.
|
|
//
|
|
// result, _, err := c.PERFORM(dialog.TaskOpenDirectory{Options: dialog.OpenDirectoryOptions{Title: "Choose folder"}})
|
|
// path := result.(string)
|
|
type TaskOpenDirectory struct{ Options OpenDirectoryOptions }
|
|
|
|
// TaskMessageDialog presents a message dialog of the given type.
|
|
//
|
|
// result, _, err := c.PERFORM(dialog.TaskMessageDialog{Options: dialog.MessageDialogOptions{Type: dialog.DialogQuestion, Title: "Confirm", Message: "Delete?", Buttons: []string{"Yes", "No"}}})
|
|
// clicked := result.(string)
|
|
type TaskMessageDialog struct{ Options MessageDialogOptions }
|
|
|
|
// TaskInfo presents an information message dialog.
|
|
//
|
|
// result, _, err := c.PERFORM(dialog.TaskInfo{Title: "Done", Message: "File saved successfully."})
|
|
// clicked := result.(string)
|
|
type TaskInfo struct {
|
|
Title string
|
|
Message string
|
|
Buttons []string
|
|
}
|
|
|
|
// TaskQuestion presents a question message dialog.
|
|
//
|
|
// result, _, err := c.PERFORM(dialog.TaskQuestion{Title: "Confirm", Message: "Delete file?", Buttons: []string{"Yes", "No"}})
|
|
// if result.(string) == "Yes" { deleteFile() }
|
|
type TaskQuestion struct {
|
|
Title string
|
|
Message string
|
|
Buttons []string
|
|
}
|
|
|
|
// TaskWarning presents a warning message dialog.
|
|
//
|
|
// result, _, err := c.PERFORM(dialog.TaskWarning{Title: "Low disk", Message: "Disk space is critically low."})
|
|
type TaskWarning struct {
|
|
Title string
|
|
Message string
|
|
Buttons []string
|
|
}
|
|
|
|
// TaskError presents an error message dialog.
|
|
//
|
|
// result, _, err := c.PERFORM(dialog.TaskError{Title: "Operation failed", Message: err.Error()})
|
|
type TaskError struct {
|
|
Title string
|
|
Message string
|
|
Buttons []string
|
|
}
|