Мы используем Makefile думая, что нет альтернатив, что это стандарт и всё такое.
Но make это не запускалка команд, а система сборки. Мы фактически используем его не по назначению.
И на самом деле альтернатива есть! Некоторое время назад я открыл для себя прекрасный инструмент - just. Он решает все проблемы make.
just - это не система сборки как make, это именно исполнитель команд!
Больше никаких Phony Targets и табуляций, привет нормальный синтаксис и передача аргументов!!! 😎
⭐️Что умеет just:
✅ Автодокументирование команд
Не нужно делать отдельную команду с докой, просто добавь комментарий
# команда сборки
build:
...
$ just --list
Available recipes:
build # команда сборки
Команда с именем default запускается по умолчанию если не указано другое, так что я обычно делаю так:
default:
just --list
Теперь просто выполняем just и получаем доку из текущего файла.
✅ Удобная работа с переменными окружения
# загрузить из .env
set dotenv-load
# глобальная переменная
export PYTHONPATH := "./src"
# переменная для команды
test $TESTUNG="true":
pytest
✅ Передача аргументов
build target:
@echo 'Build {{target}}...'
команда запуска
$ just build dev
# Build dev...
✅ Выбор интерпретатора прямо в команде
Пример с инлайн-скриптом на python:
system:
#!/usr/bin/env python3
import platform
print(platform.system())
Эта же функция позволит выполнить скрипт как одну команду вместо перезапуска шела для каждой строки
foo:
#!/usr/bin/env sh
for file in ls .; do
echo $file
done
✅ Выполнение команды в определенной директории. Можно указать как релятивный путь так и абсолютный
[working-directory: 'backend']
build:
docker compose build
Также можно задать рабочую директорию глобально
Там еще много интересного:
- поддержка функций
- автокомплиты и интеграции
- экспрешены
- алиасы команд
- группировка команд
- альтернативы команды под разные ОС
- импорт других just-файлов
- цветной вывод
- ... и другие штуковины!
Так что вперёд - ➡️ читать доку!
Репозиторий: ➡️https://github.com/casey/just
Статья: ➡️https://www.chicks.net/reference/file_formats/just/
ЗЫ. Кажется, на Makefile я уже не вернусь)
#tools
🌎 Australian megafauna like Diprotodon, the largest marsupial ever, disappeared about 46,000 years ago. These giant wombat relatives weighed up to 2,750 kilograms. The cause of their extinction is debated—some studies suggest climate shifts, while others blame human hunting. Diprotodon fossils have been found at over 100 sites across Australia. ✨
#extinctanimals⚡#megafauna⚡#paleontology
👉subscribe Interesting Planet
👉more Channels
🌎 The mysterious extinction of the “Siberian unicorn,” or Elasmotherium sibiricum, puzzles paleontologists. This massive Ice Age mammal, related to modern rhinos, had a large forehead horn and grazed Eurasian steppes. DNA studies show it survived until about 39,000 years ago—much later than once thought. ✨
#extinctanimals⚡#paleontology⚡#iceage
👉subscribe Interesting Planet
👉more Channels
🌎 The woolly rhinoceros, Coelodonta antiquitatis, roamed Ice Age Eurasia with a thick fur coat and massive horn. Fossils found in Siberian permafrost show it survived extreme cold; its extinction about 14,000 years ago is linked to climate warming and human hunting. ✨
#extinctanimals⚡#paleontology⚡#iceage
👉subscribe Interesting Planet
👉more Channels
🌎 The giant short-faced bear, Arctodus simus, roamed North America during the last Ice Age. Standing up to 1.5 meters at the shoulder, it was one of the largest terrestrial mammalian carnivores ever, yet paleontologists debate if it was mainly a predator or a scavenger. Fossils suggest it vanished around 11,000 years ago, along with much other megafauna. ✨
#extinctanimals⚡#paleontology⚡#iceage
👉subscribe Interesting Planet
👉more Channels
🌎 The Siberian unicorn, or Elasmotherium, was a massive prehistoric rhinoceros with a single huge horn on its forehead. Fossils show it roamed Eurasia until about 39,000 years ago, much later than once believed. ✨
#extinctanimals⚡#paleontology⚡#iceage
👉subscribe Interesting Planet
🌎 The thylacine, or Tasmanian tiger, was a striped marsupial predator native to Australia and Tasmania. Despite reports of sightings, the species was declared extinct in 1936 after the last known individual died in captivity. Intensive searches and camera traps have never produced concrete evidence of survival, but mystery sightings continue to spark debate among biologists. ✨
#extinctanimals⚡#marsupials⚡#australia
👉subscribe Interesting Planet