-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
65 lines (62 loc) · 1.33 KB
/
main.go
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
package main
import (
"github.com/urfave/cli/v2"
"os"
)
func main() {
// Initialize the application
app := &cli.App{
Name: "mtafoubs",
Usage: "Move to and from the Trash",
Action: func(context *cli.Context) error {
return errHandler(moveToTrash, context)
},
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "verbose",
Usage: "Print verbose output",
Required: false,
Value: false,
},
},
Commands: []*cli.Command{
{
Name: "put",
Aliases: []string{"mv", "trash"},
Usage: "Move a file to the Trash",
Action: func(context *cli.Context) error {
return errHandler(moveToTrash, context)
},
},
{
Name: "restore",
Aliases: []string{"res"},
Usage: "Restores a file from the Trash",
Action: func(context *cli.Context) error {
return errHandler(restoreFile, context)
},
},
{
Name: "empty",
Aliases: []string{"emp"},
Usage: "Empty the Trash",
Action: func(context *cli.Context) error {
return errHandler(emptyTrash, context)
},
},
{
Name: "list",
Aliases: []string{"ls"},
Usage: "List files in the Trash",
Action: func(context *cli.Context) error {
return errHandler(listTrash, context)
},
},
},
}
// Run the application
err := app.Run(os.Args)
if err != nil {
return
}
}