feat: wrap commands to send info (#612)

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

View File

@@ -13,14 +13,11 @@ var configCatCmd = &cobra.Command{
Short: "Prints the configuration",
Long: `Prints the configuration.`,
Args: cobra.NoArgs,
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)
auther, err := st.Auth.Get(s.AuthMethod)
auther, err := d.store.Auth.Get(s.AuthMethod)
checkErr(err)
printSettings(s, auther)
},
}, pythonConfig{}),
}