-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmain.v
More file actions
55 lines (51 loc) · 1.13 KB
/
main.v
File metadata and controls
55 lines (51 loc) · 1.13 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
55
module main
import os
import common
import worker
import php
import composer
import compile
fn init() {
php_dir := common.app_path('/php')
cache_dir := common.app_path('/cache')
script_dir := common.app_path('/script')
mut arr := []string{}
arr << php_dir
arr << script_dir
arr << cache_dir
// 创建文件夹
for i in arr {
if os.is_dir(i) {
common.chmod_all(i, 0o777) or { println('chmod ${i} failed') }
} else {
os.mkdir(i, os.MkdirParams{}) or { println('Failed to create the "${i}" directory') }
}
}
}
fn main() {
args := common.get_args()
if args.len == 0 {
common.dump('help')!
} else {
match args[0] {
'run' { worker.run()! }
'php' { php.run()! }
'composer' { composer.run()! }
'compile' { compile.run()! }
'add' { php.add_run()! }
'search' { php.search_run()! }
'lists' { php.lists_run()! }
'delete' { php.delete_run()! }
'clean' { clean()! }
'-v' { common.dump('version')! }
'-h' { common.dump('help')! }
else { common.dump('help')! }
}
}
}
fn clean() ! {
println('清理缓存...')
cache_dir := common.app_path('/cache')
common.rm_all(cache_dir)!
println('清理完成')
}