-
Notifications
You must be signed in to change notification settings - Fork 343
Expand file tree
/
Copy pathfix_rust.sh
More file actions
executable file
·37 lines (30 loc) · 1.12 KB
/
Copy pathfix_rust.sh
File metadata and controls
executable file
·37 lines (30 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/sh
set -e # Exit immediately if a command exits with a non-zero status.
# Function to check for git changes and commit if necessary.
commit_if_changes() {
if [ -n "$(git status --porcelain)" ]; then
echo "changes detected, committing..."
git commit -am "$1"
echo "commit created."
fi
}
# Step 1: Run cargo check and commit changes to Cargo.lock if any
SKIP_WASM_BUILD=1 cargo check --workspace
commit_if_changes "commit Cargo.lock"
# Step 2: Run cargo clippy with fixes and commit changes if any.
SKIP_WASM_BUILD=1 cargo clippy --fix --workspace --all-features --all-targets
commit_if_changes "cargo clippy"
# Step 3: Run cargo fix and commit changes if any.
SKIP_WASM_BUILD=1 cargo fix --workspace --all-features --all-targets
commit_if_changes "cargo fix"
# Step 4: Run cargo fmt and commit changes if any.
cargo fmt --all
commit_if_changes "cargo fmt"
if command -v zepter >/dev/null 2>&1; then
echo "running 'zepter run default'..."
zepter run default
commit_if_changes "zepter run default"
else
echo "ERROR: zepter not found. Install with: cargo install zepter" >&2
exit 1
fi