Мы используем 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
🌎 In 2016, astronomers discovered TRAPPIST-1, a star system 40 light-years away with seven Earth-sized planets. Three orbit in the "habitable zone," where liquid water could exist—making it one of the most promising sites for searching for alien life beyond our solar system. ✨
#astronomy⚡#exoplanets⚡#habitable
👉subscribe Interesting Planet
🪐 Astronomers have identified the super-Earth exoplanet HD 40307g, located about 42 light-years away in the constellation Pictor, as a promising candidate for life because it may orbit within its star’s habitable zone—the region where temperatures could allow liquid water on the surface. With a mass at least seven times that of Earth and the right distance from its parent star, HD 40307g offers a real-world example of a potentially life-friendly world beyond our solar system. ✨
#exoplanets⚡#habitable⚡#universe⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 Orbiting the faint red star TOI-700, about 100 light-years from Earth, the exoplanet TOI-700 d sits within its star's "habitable zone"—the region around a star where temperatures might allow liquid water to exist. With a size just slightly smaller than Earth and a surface that could potentially support mild climates, TOI-700 d stands out as a real-world candidate in our search for places beyond our solar system where life could survive. ✨
#exoplanets⚡#habitable⚡#life⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
🪐 In the TRAPPIST-1 system, about 40 light-years away, seven Earth-sized exoplanets orbit a cool, dim star, and at least three of them lie in the star’s “habitable zone”—the region where temperatures might allow liquid water to exist on their surfaces. This cluster of small worlds makes TRAPPIST-1 one of the top real candidates in the search for places where life could exist beyond our solar system. ✨
#TRAPPIST1⚡#exoplanets⚡#habitable⚡#nasa⚡#galaxy⚡#stars⚡#astronomy⚡#universe⚡#cosmos⚡#space
👉subscribe Universe Mysteries
👉more Channels