-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcargo_all.sh
More file actions
33 lines (27 loc) · 820 Bytes
/
cargo_all.sh
File metadata and controls
33 lines (27 loc) · 820 Bytes
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
#!/bin/sh
args="$*"
# List of directories to process
dirs=("." "demos")
# Iterate through each directory in the list
for dir in "${dirs[@]}"; do
if [ -d "$dir" ]; then
pushd "$dir" > /dev/null
if [ -f "Cargo.toml" ]; then
echo "running command in '$dir':"
eval "cargo $args"
else
# Run the cargo command in each subdirectory
for f in *; do
if [ -d "$f" ]; then
if [ -d "$f" ] && [ -f "$f/Cargo.toml" ]; then
pushd "$f" > /dev/null
echo "running command in '$f':"
eval "cargo $args"
popd > /dev/null
fi
fi
done
fi
popd > /dev/null
fi
done