From 65521769c2b6972e6e310d945c7a54b0d3cea015 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mickae=CC=88l=20Menu?= Date: Sat, 27 Feb 2021 10:20:53 +0100 Subject: [PATCH] Disable --not-link* variants and move database to .zk/notebook.db --- adapter/sqlite/fixtures/sample.db | Bin 36864 -> 130 bytes cmd/finder_opts.go | 49 +++++++++++++++--------------- core/zk/zk.go | 2 +- core/zk/zk_test.go | 2 +- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/adapter/sqlite/fixtures/sample.db b/adapter/sqlite/fixtures/sample.db index 312c45ef31a42e934a35ecae8d3351c2839f6557..a584291b9f213c8de0953d4bf4985b513d2c6372 100644 GIT binary patch literal 130 zcmWN?!4bkB5CFhGRnUNeJK%tH1LP29R5F5jSiSCNFMiKHUb3xq&RwZ{U$;k{+yC~- zTNzI^PcG^LG5R5AOXz3^6CG(R(Q55&bO#qimy4~S2~+ZwV6uv+jw NBr*G!rJ+Dp`~bL#CaVAd literal 36864 zcmeI)Z*SU090zb8|Nn|^PyC>oat|f}Dx?NNXj*j}DQ<>BAO+Jlj}Wns%;S$!aGEX; zrqNZKv`2fsx3G86*Ra>Ihm)qNTKizy+1M!|Nvo~OT2)^Q%jf&qcfQY^ox~1q-Kps& zqdj9h?3%P7ToMQozMxbP1P`CXe0HY@Px#ywz9h~(mvt)X5tcW9jwk*SVxg=M|2y$p z{MUFp_G9dF^p|Kl@-z|+Z}0#n2tWV=5P$##-d};oVk~(16EXC}Z;ti7JvJU0CYyA+ z2lnz-Q!XnqRhrd}4Y^6(7%ksc_-cE*VnrMES%9v~8`XLwY){pCOKvK(T2~s*Zas67 zniarP89Fu&buB|p-5jtC-8Hmt()4b*)|OkTq{ar!WXTLQ2HLW+}PT(3;aQCsHm&Pf^VH8PqbQ;}=(JD0KAkd4gRkUQB1{WWdS zoi;c<_%C|*?ac?_pqR~)Y1HiQ4%qQ%>8Qr2r|&JUhuz^>Ua!eCxfo8S`gFTl-6}VC z=%&1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 b/cmd/finder_opts.go @@ -13,15 +13,16 @@ import ( type Filtering struct { Path []string `group:filter arg optional placeholder:PATH help:"Find notes matching the given path, including its descendants."` - Interactive bool `group:filter short:i help:"Select notes interactively with fzf."` - Limit int `group:filter short:n placeholder:COUNT help:"Limit the number of notes found."` - Match string `group:filter short:m placeholder:QUERY help:"Terms to search for in the notes."` - Exclude []string `group:filter short:x placeholder:PATH help:"Ignore notes matching the given path, including its descendants."` - Orphan bool `group:filter help:"Find notes which are not linked by any other note." xor:link` - LinkedBy []string `group:filter short:l placeholder:PATH help:"Find notes which are linked by the given ones." xor:link` - LinkingTo []string `group:filter short:L placeholder:PATH help:"Find notes which are linking to the given ones." xor:link` - NotLinkedBy []string `group:filter placeholder:PATH help:"Find notes which are not linked by the given ones." xor:link` - NotLinkingTo []string `group:filter placeholder:PATH help:"Find notes which are not linking to the given notes." xor:link` + Interactive bool `group:filter short:i help:"Select notes interactively with fzf."` + Limit int `group:filter short:n placeholder:COUNT help:"Limit the number of notes found."` + Match string `group:filter short:m placeholder:QUERY help:"Terms to search for in the notes."` + Exclude []string `group:filter short:x placeholder:PATH help:"Ignore notes matching the given path, including its descendants."` + Orphan bool `group:filter help:"Find notes which are not linked by any other note." xor:link` + LinkedBy []string `group:filter short:l placeholder:PATH help:"Find notes which are linked by the given ones." xor:link` + LinkingTo []string `group:filter short:L placeholder:PATH help:"Find notes which are linking to the given ones." xor:link` + // FIXME: I'm not confident this is a useful option. + // NotLinkedBy []string `group:filter placeholder:PATH help:"Find notes which are not linked by the given ones." xor:link` + // NotLinkingTo []string `group:filter placeholder:PATH help:"Find notes which are not linking to the given notes." xor:link` Related []string `group:filter placeholder:PATH help:"Find notes which might be related to the given ones." xor:link` MaxDistance int `group:filter placeholder:COUNT help:"Maximum distance between two linked notes."` Recursive bool `group:filter short:r help:"Follow links recursively."` @@ -148,21 +149,21 @@ func NewFinderOpts(zk *zk.Zk, filtering Filtering, sorting Sorting) (*note.Finde }) } - notLinkedByPaths, ok := relPaths(zk, filtering.NotLinkedBy) - if ok { - filters = append(filters, note.LinkedByFilter{ - Paths: notLinkedByPaths, - Negate: true, - }) - } - - notLinkingToPaths, ok := relPaths(zk, filtering.NotLinkingTo) - if ok { - filters = append(filters, note.LinkingToFilter{ - Paths: notLinkingToPaths, - Negate: true, - }) - } + // notLinkedByPaths, ok := relPaths(zk, filtering.NotLinkedBy) + // if ok { + // filters = append(filters, note.LinkedByFilter{ + // Paths: notLinkedByPaths, + // Negate: true, + // }) + // } + + // notLinkingToPaths, ok := relPaths(zk, filtering.NotLinkingTo) + // if ok { + // filters = append(filters, note.LinkingToFilter{ + // Paths: notLinkingToPaths, + // Negate: true, + // }) + // } relatedPaths, ok := relPaths(zk, filtering.Related) if ok { diff --git a/core/zk/zk.go b/core/zk/zk.go index 8e50817..86c85d1 100644 --- a/core/zk/zk.go +++ b/core/zk/zk.go @@ -251,7 +251,7 @@ func locateRoot(path string) (string, error) { // DBPath returns the path to the notebook database. func (zk *Zk) DBPath() string { - return filepath.Join(zk.Path, ".zk/data.db") + return filepath.Join(zk.Path, ".zk/notebook.db") } // RelPath returns the path relative to the notebook root to the given path. diff --git a/core/zk/zk_test.go b/core/zk/zk_test.go index cd25e4f..da5654e 100644 --- a/core/zk/zk_test.go +++ b/core/zk/zk_test.go @@ -13,7 +13,7 @@ func TestDBPath(t *testing.T) { wd, _ := os.Getwd() zk := &Zk{Path: wd} - assert.Equal(t, zk.DBPath(), filepath.Join(wd, ".zk/data.db")) + assert.Equal(t, zk.DBPath(), filepath.Join(wd, ".zk/notebook.db")) } func TestRootDir(t *testing.T) {