From 51d821d500ff3e20224686e0f0512b26ad6987a5 Mon Sep 17 00:00:00 2001 From: Peder Bergebakken Sundt Date: Sun, 20 Nov 2022 00:37:48 +0100 Subject: [PATCH] small fixes --- Makefile | 21 +++++++++++++-------- api.py | 4 ++-- pull.sh | 3 ++- shell.nix | 17 ++++++++++++----- 4 files changed, 29 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index 62fc43e..0bc1230 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,21 @@ +# I'm no PHONY! STYLES := $(patsubst templates/%/render.sh,%,$(wildcard templates/*/render.sh)) help: @printf "make %s\n" \ render-styles \ + render-styles-push \ $(patsubst %,render-style-%-stdout,$(STYLES)) \ $(patsubst %,render-example-card-%-stdout,$(STYLES)) \ $(patsubst %,render-style-%-live,$(STYLES)) \ $(patsubst %,render-example-card-%-live,$(STYLES)) \ - $(patsubst %,render-style-%,$(STYLES)) \ - $(patsubst %,render-example-card-%,$(STYLES)) + $(patsubst %,render-style-%-file,$(STYLES)) \ + $(patsubst %,render-style-%-file-push,$(STYLES)) \ + | sort -render-styles: $(patsubst %,render-style-%,$(STYLES)) +render-styles: $(patsubst %,render-style-%-file,$(STYLES)) + +render-styles-push: $(patsubst %,render-style-%-file-push,$(STYLES)) render-style-%-stdout: templates/%/render.sh ./"$<" | bat --language html --plain --paging never @@ -24,9 +29,9 @@ render-style-%-live: render-example-card-%-live: fd --type f . templates/$* | entr make render-example-card-$*-stdout -render-style-%: - make --quiet render-style-$*-stdout > pvv/styles/$*.html - -render-example-card-%: - ./"$<" +render-style-%-file: + mkdir -p pvv/styles + make --quiet render-style-$*-stdout > pvv/styles/$*.html +render-style-%-file-push: render-style-%-file + ./api.py set-style $* pvv/styles/$*.html diff --git a/api.py b/api.py index f01e898..11d9d31 100755 --- a/api.py +++ b/api.py @@ -61,8 +61,8 @@ def set_card(card_id: int, file: typer.FileText): @app.command() def get_styles(): # this one fails due to trailing comma - #rich.print_json(data=post("get_my_styles").json()) - rich.print(post("get_my_styles").text) + rich.print_json(data=post("get_my_styles").json()) + #rich.print(post("get_my_styles").text) @app.command() def get_style(style_id: int): diff --git a/pull.sh b/pull.sh index 1879491..843a4d1 100755 --- a/pull.sh +++ b/pull.sh @@ -7,7 +7,8 @@ test -e pvv && { } mkdir -p pvv/{cards,styles} -./api.py get-styles | hjson -c | jq '.[].id' --raw-output | +#./api.py get-styles | hjson -c | jq '.[].id' --raw-output | +./api.py get-styles | jq '.[].id' --raw-output | while read style_id; do (set -x ./api.py get-style $style_id > pvv/styles/$style_id.html diff --git a/shell.nix b/shell.nix index c52cf4e..d4b2da7 100644 --- a/shell.nix +++ b/shell.nix @@ -2,12 +2,19 @@ with import {}; pkgs.mkShell { packages = with pkgs; [ jq - hjson # to deal with broken json + gron + sd + #hjson # to deal with broken json j2cli sass libxslt - python3Packages.rich - python3Packages.httpx - python3Packages.typer - ]; + nim + ] ++ (with python3Packages; [ + libxml2 + rich + httpx + typer + # dev-only + python-lsp-server + ]); }