Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgazelka committed Oct 1, 2024
1 parent 91f1f69 commit afd1850
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions tools/run_cargo_machete.sh
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

0 comments on commit afd1850

Please sign in to comment.