Мы используем 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
#Idiom
💢Go off on a tangent
Or
💢 Go off at a tangent
🔰If a person or piece of writing goes off on a tangent or goes off at a tangent, they start saying or thinking something that is not directly connected with what they were saying or thinking before
💠Note:-
In geometry, a tangent is a straight line which touches a curve at one point
🕸 Ex:- Our teacher would occasionally go off on a tangent and start talking about something totally unrelated to the textbook.
💠Note:-
You can use other verbs instead of go
🕸 Ex:- The book's theme wandersoff on a tangent now and then.
#Idiom
🕸People in society🕸
❄️A self-made man
♣️ A person who is rich and successful because they have worked hard, not because they were born into a rich family
❄️The chattering classes
♣️ Educated people who enjoy discussing social, political and cultural issues
❄️A second-class citizen
♣️ Someone is treated as if they are less important than others in society
❄️The grass roots
♣️ Ordinary people in a political or sporting organisation, not the leaders
❄️ The silent majority
♣️ A large number of people who do not express their opinions publicly
❄️ The (men in) grey suits
♣️ People in business or politics with a lot of influence or power, although they are not well known to the public
❄️Public enemy number one
♣️ Smth or someone that a lot of people dislike or disapprove of
❄️New kid on the block
♣️ Someone who is new in a place or organisation and has many things to learn about it (informal).
#Idiom
💢Even exchange: a trade of equal value; when you return something and take something else that costs the same price
✨ Ex: If you return that jacket and get this sweater instead, it will be an even exchange. They're both $39.99.
#Idiom
💢(To) steer clear of: to avoid, usually due to a bad experience
✨ Ex: Mark got food poisoning at O'Reilly's? We'd better steer clear of that place from now on!
#Idiom
💢(To) have the magic touch: to have talent at doing something; to be able to do something difficult.
✨ Ex: You can't open that bottle? Give it to Ivan. He usually has the magic touch.