1+ import { ICON } from '../const.js' ;
12import type { Script } from '../models/Script.js' ;
3+ import type { ScriptError } from '../models/ScriptError.js' ;
24import type { Result } from '../types.js' ;
35
46export const FlowLauncher = {
57 /**
68 * Return reformatted list of scripts for Flow Launcher
79 * @param scripts list of scripts to format.
810 */
9- searchResultFormat : function ( scripts : Script [ ] ) : Result [ ] {
11+ searchScriptResultFMT : function ( scripts : Script [ ] ) : Result [ ] {
1012 return scripts . map ( script => ( {
1113 Title : script . name ?? 'No Name' ,
1214 Subtitle : script . desc ?? 'No description' ,
@@ -20,10 +22,28 @@ export const FlowLauncher = {
2022 } )
2123 ]
2224 } ,
23- IcoPath : 'icon\\app.png' ,
25+ IcoPath : ICON . app ,
2426 score : 0
2527 } ) ) ;
2628 } ,
29+
30+ /**
31+ * Return reformatted list of scripts Errors for Flow Launcher
32+ * @param scriptErrors list of scripts errors to format.
33+ */
34+ searchScriptErrorResultFMT : function ( scriptErrors : ScriptError [ ] ) : Result [ ] {
35+ return scriptErrors . map ( scriptError => ( {
36+ Title : `Unable to load ${ scriptError . filename ?? 'No filename' } ` ,
37+ Subtitle : `Error: ${ scriptError . err . message ?? 'No error' } ` ,
38+ JsonRPCAction : {
39+ method : '' , // TODO: add script error function
40+ parameters : [ ]
41+ } ,
42+ IcoPath : ICON . error ,
43+ score : 0
44+ } ) ) ;
45+ } ,
46+
2747 /**
2848 * Shows a desktop notification.
2949 * @param title The notification title.
0 commit comments