-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathscriptish.js
39 lines (34 loc) · 978 Bytes
/
scriptish.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
dactyl.assert(Cc["@scriptish.erikvold.com/scriptish-service;1"],
'Scriptish is not installed');
var scriptish = {
list: function() Scriptish_config.scripts,
get: function(name) {
let scripts = [s for each (s in scriptish.list()) if (s.name == name)];
if (scripts.length == 0){
return false;
}else{
return scripts[0];
}
},
edit: function(name) {
if (!name) return;
let script = this.get(name);
if (!script) return;
editor.editFileExternally(script._file.path);
},
completer: function(context, args) {
context.title = ["script", "description"];
context.completions = [[s.name, s.description] for each (s in scriptish.list())];
}
};
group.commands.add(['gmedit'],
'Edit an Scriptish script',
function(args) {
scriptish.edit(args[0]);
},
{
literal: 1,
completer: scriptish.completer
},
true
);