mirror of
https://github.com/acedanger/shell.git
synced 2025-12-06 01:10:12 -08:00
feat: Implement backup TUI with enhanced refresh functionality and consistent build system
This commit is contained in:
92
tui/Makefile
Normal file
92
tui/Makefile
Normal file
@@ -0,0 +1,92 @@
|
||||
# Makefile for backup-tui
|
||||
# Ensures consistent binary naming and build process
|
||||
|
||||
# Configuration
|
||||
BINARY_NAME := backup-tui
|
||||
SOURCE_FILE := main.go
|
||||
SHELL_DIR := /home/acedanger/shell
|
||||
TUI_DIR := /home/acedanger/shell/tui
|
||||
|
||||
# Go configuration
|
||||
GOCMD := go
|
||||
GOBUILD := $(GOCMD) build
|
||||
GOCLEAN := $(GOCMD) clean
|
||||
GOTEST := $(GOCMD) test
|
||||
GOGET := $(GOCMD) get
|
||||
GOMOD := $(GOCMD) mod
|
||||
|
||||
# Default target
|
||||
.PHONY: all
|
||||
all: clean deps build install
|
||||
|
||||
# Build the application
|
||||
.PHONY: build
|
||||
build:
|
||||
@echo "🔨 Building $(BINARY_NAME)..."
|
||||
cd $(TUI_DIR) && $(GOBUILD) -o $(BINARY_NAME) $(SOURCE_FILE)
|
||||
@echo "✅ Build completed: $(TUI_DIR)/$(BINARY_NAME)"
|
||||
|
||||
# Download dependencies
|
||||
.PHONY: deps
|
||||
deps:
|
||||
@echo "📦 Downloading dependencies..."
|
||||
cd $(TUI_DIR) && $(GOMOD) tidy
|
||||
@echo "✅ Dependencies updated"
|
||||
|
||||
# Install to shell directory
|
||||
.PHONY: install
|
||||
install: build
|
||||
@echo "📋 Installing to shell directory..."
|
||||
cp $(TUI_DIR)/$(BINARY_NAME) $(SHELL_DIR)/$(BINARY_NAME)
|
||||
chmod +x $(SHELL_DIR)/$(BINARY_NAME)
|
||||
@echo "✅ Installed to $(SHELL_DIR)/$(BINARY_NAME)"
|
||||
|
||||
# Clean build artifacts
|
||||
.PHONY: clean
|
||||
clean:
|
||||
@echo "🧹 Cleaning build artifacts..."
|
||||
cd $(TUI_DIR) && $(GOCLEAN)
|
||||
rm -f $(TUI_DIR)/$(BINARY_NAME)
|
||||
rm -f $(SHELL_DIR)/$(BINARY_NAME)
|
||||
@echo "✅ Clean completed"
|
||||
|
||||
# Run the application
|
||||
.PHONY: run
|
||||
run: build
|
||||
@echo "🚀 Running $(BINARY_NAME)..."
|
||||
cd $(TUI_DIR) && ./$(BINARY_NAME)
|
||||
|
||||
# Test the application
|
||||
.PHONY: test
|
||||
test:
|
||||
@echo "🧪 Running tests..."
|
||||
cd $(TUI_DIR) && $(GOTEST) -v ./...
|
||||
|
||||
# Development build (fast, no install)
|
||||
.PHONY: dev
|
||||
dev:
|
||||
@echo "🔧 Development build..."
|
||||
cd $(TUI_DIR) && $(GOBUILD) -o $(BINARY_NAME) $(SOURCE_FILE)
|
||||
@echo "✅ Development build completed"
|
||||
|
||||
# Show help
|
||||
.PHONY: help
|
||||
help:
|
||||
@echo "Available targets:"
|
||||
@echo " all - Clean, download deps, build, and install (default)"
|
||||
@echo " build - Build the application"
|
||||
@echo " deps - Download Go dependencies"
|
||||
@echo " install - Install binary to shell directory"
|
||||
@echo " clean - Remove build artifacts"
|
||||
@echo " run - Build and run the application"
|
||||
@echo " test - Run tests"
|
||||
@echo " dev - Quick development build"
|
||||
@echo " help - Show this help message"
|
||||
|
||||
# Version info
|
||||
.PHONY: version
|
||||
version:
|
||||
@echo "Binary name: $(BINARY_NAME)"
|
||||
@echo "Source file: $(SOURCE_FILE)"
|
||||
@echo "TUI directory: $(TUI_DIR)"
|
||||
@echo "Shell directory: $(SHELL_DIR)"
|
||||
Reference in New Issue
Block a user