mirror of
https://github.com/mickael-menu/zk
synced 2024-11-07 15:20:21 +00:00
Rename --linking-to filtering option to --link-to
This commit is contained in:
parent
08cc4a3c3f
commit
f1391b5a63
@ -12,4 +12,5 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
### Changed
|
||||
|
||||
* Renamed `--linking-to` filtering option to `--link-to`.
|
||||
* Multiple `--extra` variables are now separated by `,` instead of `;`.
|
||||
|
@ -482,7 +482,7 @@ SELECT note_id FROM notes_collections
|
||||
return nil, err
|
||||
}
|
||||
|
||||
case note.LinkingToFilter:
|
||||
case note.LinkToFilter:
|
||||
maxDistance = filter.MaxDistance
|
||||
err := setupLinkFilter(filter.Paths, 1, filter.Negate, filter.Recursive)
|
||||
if err != nil {
|
||||
|
@ -674,10 +674,10 @@ func TestNoteDAOFindNotLinkedBy(t *testing.T) {
|
||||
)
|
||||
}
|
||||
|
||||
func TestNoteDAOFindLinkingTo(t *testing.T) {
|
||||
func TestNoteDAOFindLinkTo(t *testing.T) {
|
||||
testNoteDAOFindPaths(t,
|
||||
note.FinderOpts{
|
||||
Filters: []note.Filter{note.LinkingToFilter{
|
||||
Filters: []note.Filter{note.LinkToFilter{
|
||||
Paths: []string{"log/2021-01-04", "ref/test/a.md"},
|
||||
Negate: false,
|
||||
Recursive: false,
|
||||
@ -687,10 +687,10 @@ func TestNoteDAOFindLinkingTo(t *testing.T) {
|
||||
)
|
||||
}
|
||||
|
||||
func TestNoteDAOFindLinkingToRecursive(t *testing.T) {
|
||||
func TestNoteDAOFindLinkToRecursive(t *testing.T) {
|
||||
testNoteDAOFindPaths(t,
|
||||
note.FinderOpts{
|
||||
Filters: []note.Filter{note.LinkingToFilter{
|
||||
Filters: []note.Filter{note.LinkToFilter{
|
||||
Paths: []string{"log/2021-01-04.md"},
|
||||
Negate: false,
|
||||
Recursive: true,
|
||||
@ -700,10 +700,10 @@ func TestNoteDAOFindLinkingToRecursive(t *testing.T) {
|
||||
)
|
||||
}
|
||||
|
||||
func TestNoteDAOFindLinkingToRecursiveWithMaxDistance(t *testing.T) {
|
||||
func TestNoteDAOFindLinkToRecursiveWithMaxDistance(t *testing.T) {
|
||||
testNoteDAOFindPaths(t,
|
||||
note.FinderOpts{
|
||||
Filters: []note.Filter{note.LinkingToFilter{
|
||||
Filters: []note.Filter{note.LinkToFilter{
|
||||
Paths: []string{"log/2021-01-04.md"},
|
||||
Negate: false,
|
||||
Recursive: true,
|
||||
@ -714,10 +714,10 @@ func TestNoteDAOFindLinkingToRecursiveWithMaxDistance(t *testing.T) {
|
||||
)
|
||||
}
|
||||
|
||||
func TestNoteDAOFindNotLinkingTo(t *testing.T) {
|
||||
func TestNoteDAOFindNotLinkTo(t *testing.T) {
|
||||
testNoteDAOFindPaths(t,
|
||||
note.FinderOpts{
|
||||
Filters: []note.Filter{note.LinkingToFilter{Paths: []string{"log/2021-01-04", "ref/test/a.md"}, Negate: true}},
|
||||
Filters: []note.Filter{note.LinkToFilter{Paths: []string{"log/2021-01-04", "ref/test/a.md"}, Negate: true}},
|
||||
},
|
||||
[]string{"ref/test/b.md", "ref/test/a.md", "log/2021-02-04.md", "index.md", "log/2021-01-04.md"},
|
||||
)
|
||||
|
@ -20,10 +20,10 @@ type Filtering struct {
|
||||
Tag []string `group:filter short:t help:"Find notes tagged with the given tags."`
|
||||
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`
|
||||
LinkTo []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`
|
||||
// NotLinkTo []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."`
|
||||
@ -144,10 +144,10 @@ func NewFinderOpts(zk *zk.Zk, filtering Filtering, sorting Sorting) (*note.Finde
|
||||
})
|
||||
}
|
||||
|
||||
linkingToPaths, ok := relPaths(zk, filtering.LinkingTo)
|
||||
linkToPaths, ok := relPaths(zk, filtering.LinkTo)
|
||||
if ok {
|
||||
filters = append(filters, note.LinkingToFilter{
|
||||
Paths: linkingToPaths,
|
||||
filters = append(filters, note.LinkToFilter{
|
||||
Paths: linkToPaths,
|
||||
Negate: false,
|
||||
Recursive: filtering.Recursive,
|
||||
MaxDistance: filtering.MaxDistance,
|
||||
@ -162,10 +162,10 @@ func NewFinderOpts(zk *zk.Zk, filtering Filtering, sorting Sorting) (*note.Finde
|
||||
// })
|
||||
// }
|
||||
|
||||
// notLinkingToPaths, ok := relPaths(zk, filtering.NotLinkingTo)
|
||||
// notLinkToPaths, ok := relPaths(zk, filtering.NotLinkTo)
|
||||
// if ok {
|
||||
// filters = append(filters, note.LinkingToFilter{
|
||||
// Paths: notLinkingToPaths,
|
||||
// filters = append(filters, note.LinkToFilter{
|
||||
// Paths: notLinkToPaths,
|
||||
// Negate: true,
|
||||
// })
|
||||
// }
|
||||
|
@ -55,8 +55,8 @@ type LinkedByFilter struct {
|
||||
MaxDistance int
|
||||
}
|
||||
|
||||
// LinkingToFilter is a note filter used to select notes being linked by another one.
|
||||
type LinkingToFilter struct {
|
||||
// LinkToFilter is a note filter used to select notes being linked by another one.
|
||||
type LinkToFilter struct {
|
||||
Paths []string
|
||||
Negate bool
|
||||
Recursive bool
|
||||
@ -85,7 +85,7 @@ func (f PathFilter) sealed() {}
|
||||
func (f ExcludePathFilter) sealed() {}
|
||||
func (f TagFilter) sealed() {}
|
||||
func (f LinkedByFilter) sealed() {}
|
||||
func (f LinkingToFilter) sealed() {}
|
||||
func (f LinkToFilter) sealed() {}
|
||||
func (f RelatedFilter) sealed() {}
|
||||
func (f OrphanFilter) sealed() {}
|
||||
func (f DateFilter) sealed() {}
|
||||
|
@ -129,7 +129,7 @@ template = "default.md"
|
||||
# Print paths separated with colons for the notes found with the given
|
||||
# arguments. This can be useful to expand a complex search query into a flag
|
||||
# taking only paths. For example:
|
||||
# zk list --linking-to "` + "`" + `zk path -m potatoe` + "`" + `"
|
||||
# zk list --link-to "` + "`" + `zk path -m potatoe` + "`" + `"
|
||||
#path = "zk list --quiet --format {{path}} --delimiter , $@"
|
||||
|
||||
# Show a random note.
|
||||
|
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 25 KiB After Width: | Height: | Size: 25 KiB |
File diff suppressed because one or more lines are too long
Before Width: | Height: | Size: 167 KiB After Width: | Height: | Size: 166 KiB |
@ -154,7 +154,7 @@ $ zk wc
|
||||
This is such a useful command, that an alias might be helpful.
|
||||
|
||||
```toml
|
||||
bl = "zk list --linking-to $@"
|
||||
bl = "zk list --link-to $@"
|
||||
```
|
||||
|
||||
### Browse the Git history of selected notes
|
||||
|
@ -27,7 +27,7 @@ $ zk edit 200911172034
|
||||
These rules apply to all the following options, when they expect a `<path>` parameter.
|
||||
|
||||
```sh
|
||||
$ zk list --linking-to 200911172034
|
||||
$ zk list --link-to 200911172034
|
||||
```
|
||||
|
||||
You can also use a nested `zk` command to pre-filter paths to feed to an option with a `<path>` argument. [See the `inline` command alias example](config-alias.md) for more explanation.
|
||||
@ -128,11 +128,11 @@ You can filter by range instead, using `--created-before`, `--created-after`, `-
|
||||
|
||||
You can use the following options to explore the web of links spanning your [notebook](notebook.md).
|
||||
|
||||
`--linked-by <path>` (or `-l`) finds the notes linked by the given one, while `--linking-to <path>` (or `-L`) searches the notes having a link to it (also known as *backlinks*).
|
||||
`--linked-by <path>` (or `-l`) finds the notes linked by the given one, while `--link-to <path>` (or `-L`) searches the notes having a link to it (also known as *backlinks*).
|
||||
|
||||
```
|
||||
--linked-by 200911172034
|
||||
--linking-to 200911172034
|
||||
--link-to 200911172034
|
||||
```
|
||||
|
||||
These options stop at the first level by default. But you can explore the whole web by adding the `--recursive` (or `-r`) option to find all the notes leading to (or from) a given note. If you feel overwhelmed, limit the distance between two notes with `--max-distance <count>`.
|
||||
|
Loading…
Reference in New Issue
Block a user