Мы используем 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
Army Chief #JosephAoun has officially been elected as #Lebanon’s new president, marking a significant moment in the country’s political landscape. Despite being a political newcomer, Aoun’s position as head of one of Lebanon’s most respected institutions has bolstered his appeal.
Widely regarded as the favored candidate of both the United States, a staunch supporter of the Lebanese army, and regional power Saudi Arabia, Aoun is seen as the best-equipped to navigate Lebanon through its fragile ceasefire and crippling financial collapse.
Turning 61 on Friday, Aoun, known for his "personal integrity," is now tasked with stepping into the void left by Michel Aoun—no relation—whose presidency ended in October 2022
Lebanese daily @alakhbarnews reported that #SaudiArabia remains firm in its stance, maintaining economic pressure on #Lebanon.
According to visitors to #Riyadh, the kingdom has conveyed that it will not contribute "a single penny" to Lebanon’s reconstruction efforts.
Well-informed sources indicate that President #JosephAoun indirectly received this message during his meeting with Saudi Crown Prince #MohammedbinSalman earlier this month.
Additionally, he was reportedly met with a firm Saudi refusal to lift the travel ban on its citizens visiting Beirut.
During their discussions, bin Salman reportedly questioned Aoun on whether he could guarantee the safety of Saudi nationals traveling along Beirut’s airport road, which is lined with images of #Hezbollah and Iranian leaders. He remarked, “At the very least, remove the pictures.”
Upon his return, Aoun relayed this request to Speaker of Parliament #NabihBerri, inquiring about the possibility of reducing the number of such images along the route.
Why do you think Saudi Arabia cares about images displayed in another country? Share your thoughts with Hoopoe.
Following a two-year vacancy, the Lebanese Parliament has elected #JosephAoun as the new President of the Republic. Here's what you need to know about him.
#LebanonPresident#LebanonPolitics#PresidentialElection#Lebanon#LebaneseParliament#MiddleEastPolitics