-
Notifications
You must be signed in to change notification settings - Fork 17
/
reset.go
37 lines (30 loc) · 763 Bytes
/
reset.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
package main
import (
"os"
"github.com/jason0x43/go-alfred"
)
// ResetCommand is a command
type ResetCommand struct{}
// About returns information about this command
func (c ResetCommand) About() alfred.CommandDef {
return alfred.CommandDef{
Keyword: "reset",
Description: "Reset this workflow, erasing all local data",
IsEnabled: true,
Arg: &alfred.ItemArg{
Keyword: "reset",
Mode: alfred.ModeDo,
},
}
}
// Do runs the command
func (c ResetCommand) Do(data string) (string, error) {
err1 := os.Remove(configFile)
err2 := os.Remove(cacheFile)
if err1 != nil || err2 != nil {
workflow.ShowMessage("One or more data files could not be removed")
} else {
workflow.ShowMessage("Workflow data cleared")
}
return "", nil
}