fix #26: check db file existence before trying to read from it

This commit is contained in:
2026-08-31 21:10:15 +02:00
parent cafc65aea7
commit 7d1317307f
3 changed files with 17 additions and 1 deletions

View File

@@ -107,6 +107,10 @@ func Get(conf *cfg.Config) *cobra.Command {
attr.Key = args[0]
}
if err := conf.DB.Exists(); err != nil {
return err
}
entry, err := conf.DB.Get(&attr)
if err != nil {
return err
@@ -207,6 +211,10 @@ func List(conf *cfg.Config) *cobra.Command {
conf.Mode = "wide"
}
if err := conf.DB.Exists(); err != nil {
return err
}
entries, err := conf.DB.List(&attr, conf.Fulltext)
if err != nil {
return err