Compare commits

...

2 Commits

Author SHA1 Message Date
b81fd55a87
sort database by title 2025-02-11 19:41:02 +01:00
e4be8a8523
allow any fuzzy finder 2025-02-11 19:09:37 +01:00

View File

@ -1,3 +1,6 @@
FZF != command -v sk || command -v fzy || command -v fzf || \
{ echo install a fuzzy finder && exit 1 ;}
help: ## Print the help message
@awk 'BEGIN {FS = ":.*?## "} /^[0-9a-zA-Z._-]+:.*?## / {printf "\033[36m%s\033[0m : %s\n", $$1, $$2}' $(MAKEFILE_LIST) | \
sort | \
@ -6,18 +9,21 @@ help: ## Print the help message
articles != find * -type f -name "*.md"
db.rec: $(articles)
printf '%s\n' '%rec: guide' > $@
printf '%s\n\n' '%sort: title' >> $@
for x in $^ ; do \
sed -n '2,/^---$$/ {/^---$$/d; p}' "$$x" |\
sed -e 's/\[ //' -e 's/ \]//' |\
tr -d '"' ;\
printf "file: %s\n\n" "$$x" ;\
done > $@
done >> $@
recsel $@ -e "requires != ''" -CR title,requires |\
while read title requires; do \
IFS=', ' && for provider in $$requires; do \
recset $@ -e "title = '$${provider}'" -f provides -a "$${title}" ;\
done ;\
done
recfix --sort $@
default += db.rec
@ -31,7 +37,7 @@ database: $(default) ## Make a database for recfiles
.PHONY: article
article: ## Write an article
@path=$$(find . -type d -printf '%P\n' | fzy); \
@path=$$(find . -type d -printf '%P\n' | $(FZF)); \
read -p "Title: " title; \
printf '%s\n' '---' >> $$path/$$title.md ; \
printf 'title: "%s"\n' "$$title" >> $$path/$$title.md ; \