chore: improvement according to suggestion

This commit is contained in:
DarshanBPatel 2024-11-19 00:45:05 +05:30
parent 9633567b39
commit 447a51d3c4
No known key found for this signature in database
GPG Key ID: 9A92CCD9899F0D22
2 changed files with 17 additions and 32 deletions

View File

@ -1,3 +1,5 @@
run: run:
./interactive-cli.sh ./interactive-cli.sh
status:
./interactive-cli.sh status

View File

@ -22,19 +22,15 @@ print_banner() {
echo echo
} }
# Show spinner while running command start_node() {
spinner() { # Start the node
local pid=$1 echo -e "\n🚀 Starting Waku node..."
local delay=0.1 docker-compose up -d &
local spinstr='|/-\'
while [ "$(ps a | awk '{print $1}' | grep $pid)" ]; do echo -e "\n${GREEN}${BOLD}✨ Your Waku node is ready!${NC}"
local temp=${spinstr#?} echo -e "📊 View metrics: http://localhost:3000"
printf " [%c] " "$spinstr" echo -e "💬 Chat interface: http://localhost:4000"
local spinstr=$temp${spinstr%"$temp"} echo -e "🔍 Check node health: make status"
sleep $delay
printf "\b\b\b\b\b\b"
done
printf " \b\b\b\b"
} }
# Function to handle Sepolia RPC setup # Function to handle Sepolia RPC setup
@ -101,14 +97,12 @@ setup() {
echo -e "${YELLOW}Keeping existing configuration${NC}" echo -e "${YELLOW}Keeping existing configuration${NC}"
read -p $'\n'"Ready to start the node? (Y/n): " start_confirm read -p $'\n'"Ready to start the node? (Y/n): " start_confirm
if [[ $start_confirm != [nN] ]]; then if [[ $start_confirm != [nN] ]]; then
docker-compose up -d start_node
fi fi
return return
fi fi
fi else
# Copy .env.example to .env if it doesn't exist # Copy .env.example to .env if it doesn't exist
if [ ! -f .env ]; then
cp .env.example .env cp .env.example .env
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo -e "${RED}Error: Could not find .env.example file${NC}" echo -e "${RED}Error: Could not find .env.example file${NC}"
@ -178,17 +172,9 @@ setup() {
# Register RLN membership # Register RLN membership
echo -e "\n📝 Registering RLN membership..." echo -e "\n📝 Registering RLN membership..."
./register_rln.sh & ./register_rln.sh &
spinner $!
# Start the node # Start the node
echo -e "\n🚀 Starting Waku node..." start_node
docker-compose up -d &
spinner $!
echo -e "\n${GREEN}${BOLD}✨ Your Waku node is ready!${NC}"
echo -e "📊 View metrics: http://localhost:3000"
echo -e "💬 Chat interface: http://localhost:4000"
echo -e "🔍 Check node health: ./waku-cli.sh status"
} }
# Interactive menu function # Interactive menu function
@ -244,9 +230,7 @@ quick_start_menu() {
press_enter press_enter
;; ;;
2) 2)
echo -e "\n${BOLD}Starting Waku node...${NC}" start_node
docker-compose up -d
echo -e "\n${GREEN}✅ Node started successfully!${NC}"
press_enter press_enter
;; ;;
3) return ;; 3) return ;;
@ -274,8 +258,7 @@ node_management_menu() {
case $choice in case $choice in
1) 1)
echo -e "\n${BOLD}Starting node...${NC}" start_node
docker-compose up -d
press_enter press_enter
;; ;;
2) 2)