fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

8.8K
active users

#justfile

0 posts0 participants0 posts today

I am still not *quite* ready to put a #justfile in each of my projects (make feels *slightly* better there) but putting one on each of my servers at `~/Justfile` with common server tasks is proving handy 😃
(I would prefer to find a rpm for my distro for just/uv instead of an install script)

The @tailscale folks have some excellent YT videos on setting up self-hosted servers on Digital Ocean using Terraform, Ansible, and of course, Tailscale. I just got my first Droplet running.

Part 1 - Getting started with cloud-init: youtu.be/e-X5FJwrkaA?si=t3iLP-
Part 2 - Terraform: youtu.be/PEoMmZOj6Cg?si=2IwHCw
Part 3 - Ansible: youtu.be/k5Xgt31yK2U?si=28MPbw

Да начнётся новая эра моего заметкописания! Я освоил новую технологию — [typst](github.com/typst/typst)! Также используюся:
- <github.com/casey/just> — альтернатива make с вменяемым синтаксисом
- <github.com/watchexec/watchexec> — следит за изменениями в файлах и запускает команды

Пример кривенького justfile на картинке.

Continued thread

Ok, this seems _pretty ok_. Each project's `justfile` will have a little boilerplate of 2 imports and a `fetch` recipe.

My default justfile can be grabbed with `just fetch` if users want it. The second import is mostly for me and my local filesystem setup.

That should solve for my local dev, make it relatively easy for other devs to get my default `justfile`, _and_ not repeat the same recipes in every project.

I think. We’ll see! 😅

github.com/adamghill/dotfiles/

Replied in thread

@jforseth210

I think you could quite easily achieve this workflow by defining a command wrapper (shell script, or even shell alias) that converts `dock project1 up` to `docker compose -f /var/docker/compose/project1.yaml up`.

That would be pretty handy IMHO, `docker compose up -d && docker compose logs -f --since=1m` is a hell of a lot to type (I alias it using #Justfile to `just up`)

Unreasonably pleased by a tiny tweak to scripts. I keep most of them in a . I have these useful help/h recipes:

# list recipes, optionally filtered by REGEX.
@help *REGEX:
if [[ '{{ REGEX }}' == '' ]]; then just -lu; else just -lu --color=always | rg --pcre2 -i '{{ REGEX }}'; true; fi

alias h := help

and shell alias j=just; so to list foo-related scripts I’m often typing

j h foo

It's short, but… I added alias h='just help’, now it’s much better:

h foo

🎉

Continued thread

And the next part: importing transactions you may have forgotten but your forecast rules have not. Nicely avoids importing transactions twice.

YEAR := `date +%Y`
FORECASTJ := YEAR / YEAR + '-forecast.journal'

# import any recent transactions generated by forecast rules; --dry to preview
@import-forecast *ARGS:
hledger import -s -I --auto --forecast=-15days..tomorrow {{ FORECASTJ }} "$@"

(import explained: hledger.org/dev/hledger.html#i)

hledger.orghledger manual (dev) - hledgerplain text accounting, made easy

I'm using `just` eg to manage developer/maintainer task scripts for , and to manage personal finance/time/task scripts.

Here's one for showing a near-term transactions forecast:

# show forecast transactions predicted recently and soon
@forecast *ARGS:
hledger print -I --auto --forecast=-15days..+15days tag:generated "$@"

(Forecasting explained: hledger.org/dev/hledger.html#f)

hledger.orghledger manual (dev) - hledgerplain text accounting, made easy
Continued thread

You can achieve some of these things with make, if you work hard enough, and ensure you have the right version, but it's more complicated, more fragile, less portable, and harder for others to understand.

Why I’m using `just` for script management after many years with make/shell:

- you can easily list recipes with their docs
- recipes have robust argument handling
- easier and smoother integration with scripting languages
- much fewer idiosyncracies
- more portable (one version, more likely to work on Windows)
- makes things more robust
- frees up vital head space.

You have to install it; and you lose the ability to depend on other outputs, for now.

Continued thread

As a bonus for anyone using my #AdventOfCode template, I've added support for the `advent` program in my Universal Test Runner!

This means you can run your solution by just pressing `t`!

For anyone not using my template, you can create a #makefile or #justfile with your own command and the test runner will pick it up too!

github.com/xavdid/universal-te

GitHubGitHub - xavdid/universal-test-runner: A language-agnostic, zero-configuration test invokerA language-agnostic, zero-configuration test invoker - xavdid/universal-test-runner
Replied in thread

@mongrelion awesome on the usage! I highly recommend reading the manual. There's a lot of capacity it provides.

That said, do have conditional expressions you can build. However, justfile goal is to be a command runner and only that. Instead of discouraging to write a script, you can use the interpreter of whatever on it directly. Meaning you can go straight to python instead if you need a full language. Not just bash.

just.systems/man/en/chapter_40

just.systemsWriting Recipes in Other Languages - Just Programmer's Manual