-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.go
More file actions
56 lines (51 loc) · 1.59 KB
/
Copy pathconfig.go
File metadata and controls
56 lines (51 loc) · 1.59 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
56
package main
type Config struct {
Title string `toml:"title"`
Width float32 `toml:"width"`
Height float32 `toml:"height"`
Apps []App `toml:"apps"`
}
type App struct {
Command Command `toml:"command"`
Items []Item `toml:"items"`
}
type Command struct {
Path string `toml:"path"`
Name string `toml:"name"`
Args []string `toml:"args"`
Mode string `toml:"mode"`
Output string `toml:"output"`
Debug bool `toml:"debug"`
RunText string `toml:"run_text"`
RunColor string `toml:"run_color"`
DebugText string `toml:"debug_text"`
DebugColor string `toml:"debug_color"`
Env map[string]string `toml:"env"`
}
type Item struct {
// label 类型
Text string `toml:"text"`
// argument 类型
Name string `toml:"name"`
Short bool `toml:"short"`
Positional bool `toml:"positional"`
Type string `toml:"type"`
Label string `toml:"label"`
Description string `toml:"description"`
Default any `toml:"default"`
Choices []string `toml:"choices"`
Placeholder string `toml:"placeholder"`
Picker string `toml:"picker"`
PickerText string `toml:"picker_text"`
Separator string `toml:"separator"`
Multi bool `toml:"multi"`
// 验证
Required bool `toml:"required"`
Validate string `toml:"validate"`
Min any `toml:"min"`
Max any `toml:"max"`
Condition string `toml:"condition"`
}
func (i *Item) IsLabel() bool {
return i.Text != "" && i.Name == ""
}