Disable --not-link* variants and move database to .zk/notebook.db

pull/6/head
Mickaël Menu 3 years ago
parent 6ce25e0ed6
commit 65521769c2
No known key found for this signature in database
GPG Key ID: 53D73664CD359895

Binary file not shown.

@ -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 {

@ -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.

@ -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) {

Loading…
Cancel
Save