RUST_VERSION := $(shell grep 'rust-version = ' Cargo.toml | head -1 | sed 's/.*rust-version = "\(.*\)"/\1/')
.PHONY: install-rust
install-rust:
rustup toolchain install $(RUST_VERSION)
rustup component add rustfmt clippy --toolchain $(RUST_VERSION)
.PHONY: check
check:
cargo +$(RUST_VERSION) check --all-features
.PHONY: fmt
fmt:
cargo +$(RUST_VERSION) fmt
.PHONY: fmt-check
fmt-check:
cargo +$(RUST_VERSION) fmt --check
.PHONY: clippy
clippy:
cargo +$(RUST_VERSION) clippy --all-targets --all-features -- -D warnings -W clippy::pedantic
.PHONY: test
test:
cargo +$(RUST_VERSION) test --all-features
.PHONY: test-doc
test-doc:
cargo +$(RUST_VERSION) test --doc --all-features
.PHONY: examples
examples:
cargo +$(RUST_VERSION) run --example table
@echo "Running crabular-cli with CSV..."
cargo +$(RUST_VERSION) run -p crabular-cli --release -- -i examples/data.csv
@echo "Running crabular-cli with TSV..."
cargo +$(RUST_VERSION) run -p crabular-cli --release -- -i examples/data.tsv --format tsv
@echo "Running crabular-cli with JSON..."
cargo +$(RUST_VERSION) run -p crabular-cli --release -- -i examples/data.json --format json
@echo "Running crabular-cli with JSONL..."
cargo +$(RUST_VERSION) run -p crabular-cli --release -- -i examples/data.jsonl --format jsonl
.PHONY: ci
ci: fmt-check clippy test test-doc examples
.PHONY: clean
clean:
cargo +$(RUST_VERSION) clean