BINARY := "count-characters"
TARGET := "target/release/{{BINARY}}"
PREFIX := "/usr/local/bin"
# Lists all available just commands
default:
@just --list
# Prints usage information
help:
@echo "usage: just [command]"
# Checks code formatting and runs Clippy linter
lint:
@echo "Checking code style..."
cargo fmt -- --check
cargo clippy -- -D warnings
# Runs lint and executes tests
test: lint
@echo "Running tests..."
cargo test
# Runs tests and builds the project in release mode
build: test
cargo build --release
@echo "Built {{BINARY}} in target/release/"
# Installs the release binary to the system prefix (platform-specific)
install:
if [ "$(uname)" = "Darwin" ] || [ "$(uname)" = "Linux" ]; then \
sudo cp {{TARGET}} {{PREFIX}}/ && \
echo "Installed {{BINARY}} to {{PREFIX}}/"; \
else \
copy {{TARGET}} %USERPROFILE%\\.cargo\\bin\\ && \
echo "Installed {{BINARY}} to %USERPROFILE%\\.cargo\\bin\\"; \
fi
# Removes the installed binary from the system prefix (platform-specific)
uninstall:
if [ "$(uname)" = "Darwin" ] || [ "$(uname)" = "Linux" ]; then \
sudo rm -f {{PREFIX}}/{{BINARY}} && \
echo "Uninstalled {{BINARY}} from {{PREFIX}}/"; \
else \
del %USERPROFILE%\\.cargo\\bin\\{{BINARY}}.exe && \
echo "Uninstalled {{BINARY}} from %USERPROFILE%\\.cargo\\bin\\"; \
fi
# Removes build artifacts
clean:
cargo clean
@echo "Cleaned build artifacts."
# Runs tests and publishes the crate to crates.io
publish: test
@echo "Publishing to crates.io..."
cargo publish