Moving db file to the flags struct
10 files changed, 13 insertions(+), 13 deletions(-)

M cmd/clear.go
M cmd/db.go
M cmd/delete.go
M cmd/files.go
M cmd/merge.go
M cmd/search.go
M cmd/stats.go
M cmd/tag.go
M cmd/tags.go
M lib/db.go
M cmd/clear.go +2 -2
@@ 39,7 39,7 @@ func init() {
 // ClearFiles remove all tags for given file
 func ClearFiles(cmd *cobra.Command, args []string) error {
 	cmd.SilenceUsage = true // Usage is correct, don't show on errors
-	qm, err := lib.NewQueryManager(dbFile)
+	qm, err := lib.NewQueryManager()
 	if err != nil {
 		return err
 	}

          
@@ 64,7 64,7 @@ func ClearFiles(cmd *cobra.Command, args
 // ClearTags remove all tag assignments for given tag
 func ClearTags(cmd *cobra.Command, args []string) error {
 	cmd.SilenceUsage = true // Usage is correct, don't show on errors
-	qm, err := lib.NewQueryManager(dbFile)
+	qm, err := lib.NewQueryManager()
 	if err != nil {
 		return err
 	}

          
M cmd/db.go +1 -1
@@ 73,7 73,7 @@ func DatabaseInit(cmd *cobra.Command, ar
 // UpgradeSchema upgrades db schema if needed
 func UpgradeSchema(cmd *cobra.Command, args []string) error {
 	cmd.SilenceUsage = true // Usage is correct, don't show on errors
-	qm, err := lib.NewQueryManager(dbFile)
+	qm, err := lib.NewQueryManager()
 	if err != nil {
 		return err
 	}

          
M cmd/delete.go +2 -2
@@ 39,7 39,7 @@ func init() {
 // DeleteFiles deletes files from db
 func DeleteFiles(cmd *cobra.Command, args []string) error {
 	cmd.SilenceUsage = true // Usage is correct, don't show on errors
-	qm, err := lib.NewQueryManager(dbFile)
+	qm, err := lib.NewQueryManager()
 	if err != nil {
 		return err
 	}

          
@@ 64,7 64,7 @@ func DeleteFiles(cmd *cobra.Command, arg
 // DeleteTags deletes tags from db
 func DeleteTags(cmd *cobra.Command, args []string) error {
 	cmd.SilenceUsage = true // Usage is correct, don't show on errors
-	qm, err := lib.NewQueryManager(dbFile)
+	qm, err := lib.NewQueryManager()
 	if err != nil {
 		return err
 	}

          
M cmd/files.go +1 -1
@@ 24,7 24,7 @@ func init() {
 func ListFiles(cmd *cobra.Command, args []string) error {
 	cmd.SilenceUsage = true // Usage is correct, don't show on errors
 	ctype, _ := cmd.Flags().GetString("ctype")
-	qm, err := lib.NewQueryManager(dbFile)
+	qm, err := lib.NewQueryManager()
 	if err != nil {
 		return err
 	}

          
M cmd/merge.go +1 -1
@@ 22,7 22,7 @@ func init() {
 // MergeTags merges all tags from old-tag into new-tag
 func MergeTags(cmd *cobra.Command, args []string) error {
 	cmd.SilenceUsage = true // Usage is correct, don't show on errors
-	qm, err := lib.NewQueryManager(dbFile)
+	qm, err := lib.NewQueryManager()
 	if err != nil {
 		return err
 	}

          
M cmd/search.go +1 -1
@@ 29,7 29,7 @@ func SearchFiles(cmd *cobra.Command, arg
 	ltags, _ := cmd.Flags().GetString("tags")
 	conf := &lib.SearchFilesConfig{Search: args[0]}
 
-	qm, err := lib.NewQueryManager(dbFile)
+	qm, err := lib.NewQueryManager()
 	if err != nil {
 		return err
 	}

          
M cmd/stats.go +1 -1
@@ 22,7 22,7 @@ func init() {
 // ListTags lists all tags in the database
 func ListTags(cmd *cobra.Command, args []string) error {
 	cmd.SilenceUsage = true // Usage is correct, don't show on errors
-	qm, err := lib.NewQueryManager(dbFile)
+	qm, err := lib.NewQueryManager()
 	if err != nil {
 		return err
 	}

          
M cmd/tag.go +1 -1
@@ 41,7 41,7 @@ func TagFile(cmd *cobra.Command, args []
 	ltags, _ := cmd.Flags().GetString("tags")
 	desc, _ := cmd.Flags().GetString("desc")
 	index, _ := cmd.Flags().GetBool("index")
-	qm, err := lib.NewQueryManager(dbFile)
+	qm, err := lib.NewQueryManager()
 	if err != nil {
 		return err
 	}

          
M cmd/tags.go +1 -1
@@ 22,7 22,7 @@ func init() {
 // ShowFileTags shows tags assigned to given file
 func ShowFileTags(cmd *cobra.Command, args []string) error {
 	cmd.SilenceUsage = true // Usage is correct, don't show on errors
-	qm, err := lib.NewQueryManager(dbFile)
+	qm, err := lib.NewQueryManager()
 	if err != nil {
 		return err
 	}

          
M lib/db.go +2 -2
@@ 201,8 201,8 @@ func GetDBTransaction(db *sqlx.DB) (*sql
 }
 
 // NewQueryManager returns a new QueryManager instance
-func NewQueryManager(dbFile string) (*QueryManager, error) {
-	db, err := GetDatabase(dbFile)
+func NewQueryManager() (*QueryManager, error) {
+	db, err := GetDatabase(TagoRunFlags.DbFile)
 	if err != nil {
 		fmt.Fprintf(
 			os.Stderr,