Files
lk/cmd.mk
Malin Freeborn c00c9aed16 begin command-snippets db
command.rec will be stored here, and generate articles.
2026-03-26 22:44:23 +01:00

26 lines
696 B
Makefile

cmds != recsel command.rec -t command -G bin -U -CP bin
lists = $(patsubst %,lists/%.md, $(cmds))
default += $(lists)
get_title = printf 'title: "%s"\n' '${1}'
get_tags = recsel -t $(basename $<) $< -G bin \
-e 'bin = "$(1)"' -U -CP tag | \
sed 's/.*/"&",/g' | \
tr '\n' ' ' | \
sed 's/.*/tags: [ &]/'
list_commands = recsel -t $(basename $<) $< -e 'bin = "$(1)"' | \
recfmt -f lists.fmt
lists/%.md: command.rec | lists/
@printf '%s\n' '---' > $@
@$(call get_title,$(basename $(notdir $@))) >> $@
@$(call get_tags,$(basename $(notdir $@))) >> $@
@printf '\n%s\n' '---' >> $@
@$(call list_commands,$(basename $(notdir $@))) >> $@
.PHONY: cmd
cmd: $(lists) ## Bit lists of commands