feat: wrap commands to send info (#612)

Wrap commands in a better way to pass storage
This commit is contained in:
Henrique Dias authored and GitHub committed 2019-01-07 20:24:23 +00:00
1 parent f396602084
commit 01ff03e426
16 files changed
+170 -212

No files matched your search

+4 -7
View File
@@ -27,11 +27,8 @@ var cmdsRmCmd = &cobra.Command{
return nil
},
Run: func(cmd *cobra.Command, args []string) {
db := getDB()
defer db.Close()
st := getStorage(db)
s, err := st.Settings.Get()
Run: python(func(cmd *cobra.Command, args []string, d pythonData) {
s, err := d.store.Settings.Get()
checkErr(err)
evt := args[0]
@@ -44,8 +41,8 @@ var cmdsRmCmd = &cobra.Command{
}
s.Commands[evt] = append(s.Commands[evt][:i], s.Commands[evt][f+1:]...)
err = st.Settings.Save(s)
err = d.store.Settings.Save(s)
checkErr(err)
printEvents(s.Commands)
},
}, pythonConfig{}),
}