Skip to content

Commit e5482da

Browse files
authored
Merge pull request #239 from jirigrill/makefile-refactoring
sim-ln/refactor: Update help, add new cmds in Makefile
2 parents 1637888 + bd24179 commit e5482da

File tree

1 file changed

+25
-13
lines changed

1 file changed

+25
-13
lines changed

Makefile

+25-13
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
LOG_LEVEL ?= info
22
DEFAULT_DATA_DIR ?= /data_dir
33
DEFAULT_SIMFILE_PATH ?= /data_dir/sim.json
4+
FMT_CMD = cargo fmt --verbose --all -- --color always --config-path=./rustfmt.toml
5+
CLIPPY_CMD = cargo clippy --all-features --all-targets --color always
46

57
build-docker:
68
docker build -f docker/Dockerfile -t sim-ln .
@@ -10,19 +12,25 @@ mount-volume:
1012

1113
help:
1214
@echo "Makefile commands:"
13-
@echo "build-docker Builds the Docker image."
14-
@echo "mount-volume Mounts the specified volume."
15-
@echo "run Runs the Docker container."
16-
@echo "run-interactive Runs the Docker container in interactive mode."
17-
@echo "stop Stops the Docker container."
15+
@echo " build-docker Builds the Docker image."
16+
@echo " mount-volume Mounts the specified volume."
17+
@echo " run-docker Runs the Docker container in detached mode."
18+
@echo " run-interactive Runs the Docker container in interactive mode."
19+
@echo " stop-docker Stops the Docker container."
20+
@echo " check Runs code formatting and linting checks."
21+
@echo " check-code Runs code formatting and linting without stability check."
22+
@echo " format Fixes both formatting and linting issues in one go."
23+
@echo " stable-output Checks for unstaged/uncommitted changes after checks."
24+
@echo " install Installs the simulation CLI."
25+
@echo " dev-install Installs the simulation CLI with development features."
1826
@echo ""
1927
@echo "Variables:"
20-
@echo "SIMFILE_PATH Path to the sim.json file."
21-
@echo "LOG_LEVEL Set the logging level (default: info) e.g. <make run LOG_LEVEL=debug>."
22-
@echo "HELP Set to true to print the help message (default: false) e.g. <make run HELP=true>."
23-
@echo "PRINT_BATCH_SIZE Set the batch size for printing the results e.g. <make run PRINT_BATCH_SIZE=100>."
24-
@echo "TOTAL_TIME Set the total time for the simulation e.g. <make run TOTAL_TIME=1000>."
25-
@echo "DATA_DIR Set the data directory for the simulation containing simulation files and results e.g. <make run-docker DATA_DIR="/Users/anon/data_dir>"."
28+
@echo " SIMFILE_PATH Path to the sim.json file."
29+
@echo " LOG_LEVEL Set the logging level (default: info) e.g. <make run-docker LOG_LEVEL=debug>."
30+
@echo " HELP Set to true to print the help message (default: false) e.g. <make run-docker HELP=true>."
31+
@echo " PRINT_BATCH_SIZE Set the batch size for printing the results e.g. <make run-docker PRINT_BATCH_SIZE=100>."
32+
@echo " TOTAL_TIME Set the total time for the simulation e.g. <make run-docker TOTAL_TIME=1000>."
33+
@echo " DATA_DIR Set the data directory for the simulation containing simulation files and results e.g. <make run-docker DATA_DIR=\"/Users/anon/data_dir\">."
2634

2735
run-docker:
2836
docker run -d --rm --name sim-ln --init -v simln-data:${DEFAULT_DATA_DIR} -e SIMFILE_PATH=${DEFAULT_SIMFILE_PATH} -e LOG_LEVEL=$(LOG_LEVEL) -e HELP=${HELP} -e PRINT_BATCH_SIZE=${PRINT_BATCH_SIZE} -e TOTAL_TIME=${TOTAL_TIME} sim-ln
@@ -34,8 +42,8 @@ stop-docker:
3442
docker stop sim-ln
3543

3644
check-code:
37-
cargo fmt --verbose --check --all -- --color always
38-
cargo clippy --all-features --all-targets --color always -- -D warnings
45+
$(FMT_CMD) --check
46+
$(CLIPPY_CMD) -- -D warnings
3947

4048
stable-output:
4149
@if [ -n "$$(git status --porcelain)" ]; then \
@@ -52,3 +60,7 @@ install:
5260

5361
dev-install:
5462
RUSTFLAGS="--cfg tokio_unstable" cargo install --locked --path sim-cli --features dev
63+
64+
format:
65+
$(FMT_CMD)
66+
$(CLIPPY_CMD) --fix --allow-dirty --allow-staged -- -D warnings

0 commit comments

Comments
 (0)