Browse Source

bin/notes-pages: add --format name

main
Brennen Bearnes 1 year ago
parent
commit
6eee2c41f1
2 changed files with 13 additions and 4 deletions
  1. +7
    -3
      home/bin/notes-pages
  2. +6
    -1
      home/bin/notes-tag-index

+ 7
- 3
home/bin/notes-pages View File

@ -17,7 +17,7 @@ Currently this is vimwiki-dependent.
notes pages --date 2022-07-18
# Set output format:
notes pages --format [vimwiki, tsv, location, full]
notes pages --format [vimwiki, tsv, location, full, name]
# All pages with a date:
notes pages --with-date
@ -90,6 +90,12 @@ my %FORMATS = (
return $result . "\n";
},
# Bare names of wiki pages (no extension):
name => sub {
my ($data) = @_;
return $data->{page} . "\n";
},
# Fulltext of vimwiki pages:
full => sub {
my ($data) = @_;
@ -98,8 +104,6 @@ my %FORMATS = (
$result .= "%% $pagepath {{{\n\n";
$result .= file_get_contents($pagepath);
$result .= "\n%% }}}\n\n";
return $result;
},
);


+ 6
- 1
home/bin/notes-tag-index View File

@ -2,7 +2,12 @@
cd "$HOME/notes" || exit 1
sort <(sqlite3 metadata.db 'SELECT DISTINCT(page) FROM pages WHERE page NOT LIKE "log/%" AND page NOT LIKE "diary/%"') \
# Arguably the following should select _things that are linked to_ as well.
# Also, arguably, the grep should be done in notes-pages instead. It was
# just kind of a pain when I was looking at this.
sort \
<(notes-pages --format name| grep -v '^(log|diary)/') \
pinboard-tag-index \
p1k3-index \
| uniq

|||||||
x
 
000:0
Loading…
Cancel
Save