-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
23 lines (19 loc) · 791 Bytes
/
Copy pathinstall.sh
File metadata and controls
23 lines (19 loc) · 791 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# Create the list
line=$(sed -n '3p' Cargo.toml)
members=$(echo $line | cut -d '=' -f 2 | tr -d '[' | tr -d ']')
IFS=',' read -ra member_list <<< "$members"
# Sort the list in descending order
IFS=$'\n' GLOBIGNORE='*' member_list=($(printf '%s\n' ${member_list[@]} | awk '{ print length($0) " " $0; }' | sort -n -r | cut -d ' ' -f 2-))
echo -ne "\033[0;32m"
for member in "${member_list[@]}"; do
member_stripped="${member//\"/}"
member_stripped=$(echo $member_stripped | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')
if [ "$member_stripped" != "strawberry" ]; then
echo "[ ] Installing $member_stripped"
cargo install --path $member_stripped -q "$@"
if [ $? -eq 0 ]; then
echo -e "\e[1A\e[K[x] Installed $member_stripped"
fi
fi
done
echo -ne "\033[0m"