-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.go
More file actions
82 lines (77 loc) · 1.77 KB
/
main.go
File metadata and controls
82 lines (77 loc) · 1.77 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
package main
import (
"go.bbkane.com/warg"
"go.bbkane.com/warg/path"
"go.bbkane.com/warg/value/scalar"
"go.bbkane.com/warg/value/slice"
)
var version string
func app() *warg.App {
linkUnlinkFlags := warg.FlagMap{
"--ask": warg.NewFlag(
"Whether to ask before making changes",
scalar.String(
scalar.Choices("true", "false", "dry-run"),
scalar.Default("true"),
),
warg.Required(),
),
"--dotfiles": warg.NewFlag(
"Files/dirs starting with 'dot-' will have links starting with '.'",
scalar.Bool(
scalar.Default(true),
),
warg.Required(),
),
"--ignore": warg.NewFlag(
"Ignore file/dir if the name (not the whole path) matches passed regex",
slice.String(
slice.Default([]string{"README.*"}),
),
warg.Alias("-i"),
warg.UnsetSentinel("UNSET"),
),
"--link-dir": warg.NewFlag(
"Symlinks will be created in this directory pointing to files/directories in --src-dir",
scalar.Path(
scalar.Default(path.New("~")),
),
warg.Alias("-l"),
warg.FlagCompletions(warg.CompletionsDirectories()),
warg.Required(),
),
"--src-dir": warg.NewFlag(
"Directory containing files and directories to link to",
scalar.Path(),
warg.Alias("-s"),
warg.FlagCompletions(warg.CompletionsDirectories()),
warg.Required(),
),
}
app := warg.New(
"fling",
version,
warg.NewSection(
"Link and unlink directory heirarchies ",
warg.NewSubCmd(
"link",
"Create links",
link,
warg.CmdFlagMap(linkUnlinkFlags),
),
warg.NewSubCmd(
"unlink",
"Unlink previously created links",
unlink,
warg.CmdFlagMap(linkUnlinkFlags),
),
warg.SectionFooter("Homepage: https://github.com/bbkane/fling"),
),
warg.SkipValidation(),
)
return &app
}
func main() {
app := app()
app.MustRun()
}