forked from devlive-community/codeforge
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapplescript.rs
More file actions
54 lines (45 loc) · 1.47 KB
/
applescript.rs
File metadata and controls
54 lines (45 loc) · 1.47 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
use super::{LanguagePlugin, PluginConfig};
use std::vec;
pub struct AppleScriptPlugin;
impl LanguagePlugin for AppleScriptPlugin {
fn get_order(&self) -> i32 {
15
}
fn get_language_name(&self) -> &'static str {
"AppleScript"
}
fn get_language_key(&self) -> &'static str {
"applescript"
}
fn get_file_extension(&self) -> String {
self.get_config()
.map(|config| config.extension.clone())
.unwrap_or_else(|| "applescript".to_string())
}
fn get_version_args(&self) -> Vec<&'static str> {
vec!["-e", "version of AppleScript"]
}
fn get_path_command(&self) -> String {
"which osascript".to_string()
}
fn get_default_config(&self) -> PluginConfig {
PluginConfig {
enabled: true,
language: String::from("applescript"),
before_compile: None,
extension: String::from("applescript"),
execute_home: None,
run_command: Some(String::from("osascript $filename")),
after_compile: None,
template: Some(String::from("-- 在这里输入 AppleScript 代码")),
timeout: Some(45),
console_type: Some(String::from("console")),
icon_path: None,
}
}
fn get_default_command(&self) -> String {
self.get_config()
.and_then(|config| config.run_command.clone())
.unwrap_or_else(|| "osascript".to_string())
}
}