-
Notifications
You must be signed in to change notification settings - Fork 174
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
91f1f69
commit afd1850
Showing
1 changed file
with
16 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,26 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# ANSI color codes | ||
RED='\033[0;31m' | ||
YELLOW='\033[1;33m' | ||
GREEN='\033[0;32m' | ||
NC='\033[0m' # No Color | ||
|
||
# Function to print colored messages | ||
print_message() { | ||
local color=$1 | ||
local message=$2 | ||
echo -e "${color}${message}${NC}" | ||
} | ||
|
||
# Check if cargo-machete is installed | ||
if ! command -v cargo-machete &> /dev/null | ||
then | ||
echo -e "${YELLOW}Warning: cargo-machete could not be found${NC}" | ||
echo -e "${YELLOW}To install, run: ${GREEN}cargo install cargo-machete${NC}" | ||
echo -e "${YELLOW}Skipping cargo-machete check${NC}" | ||
else | ||
# Run cargo-machete with the --with-metadata flag | ||
echo -e "${GREEN}Running cargo-machete...${NC}" | ||
cargo machete --with-metadata | ||
fi | ||
command -v cargo-machete >/dev/null 2>&1 || { | ||
print_message "$YELLOW" "Warning: cargo-machete could not be found" | ||
print_message "$YELLOW" "To install, run: cargo install cargo-machete" | ||
print_message "$RED" "Exiting due to missing cargo-machete" | ||
exit 1 | ||
} | ||
|
||
# Always exit with 0 to not fail | ||
exit 0 | ||
# Run cargo-machete | ||
cargo machete --with-metadata |