Compare commits

..

1 Commits

Author SHA1 Message Date
e45aa04b05 Version v0.2.13 - Some more changes to build.sh 2025-08-10 09:57:47 -04:00
2 changed files with 35 additions and 7 deletions

View File

@@ -200,3 +200,4 @@ When contributing:
2. For major features, consider manually creating minor version tags 2. For major features, consider manually creating minor version tags
3. Generated version files (`src/version.*`, `VERSION`) should not be committed 3. Generated version files (`src/version.*`, `VERSION`) should not be committed
# Test change # Test change
# Testing -m flag

View File

@@ -13,6 +13,23 @@ print_success() { echo -e "${GREEN}[SUCCESS]${NC} $1"; }
print_warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; } print_warning() { echo -e "${YELLOW}[WARNING]${NC} $1"; }
print_error() { echo -e "${RED}[ERROR]${NC} $1"; } print_error() { echo -e "${RED}[ERROR]${NC} $1"; }
# Global variable for commit message
COMMIT_MESSAGE=""
# Parse command line arguments for -m flag
while [[ $# -gt 0 ]]; do
case $1 in
-m|--message)
COMMIT_MESSAGE="$2"
shift 2
;;
*)
# Keep other arguments for main logic
break
;;
esac
done
# Function to automatically increment version # Function to automatically increment version
increment_version() { increment_version() {
print_status "Incrementing version..." print_status "Incrementing version..."
@@ -57,16 +74,18 @@ increment_version() {
print_warning "Failed to stage changes (maybe not a git repository)" print_warning "Failed to stage changes (maybe not a git repository)"
fi fi
# Prompt for commit message # Handle commit message - use global variable if set, otherwise prompt
if [[ -z "$COMMIT_MESSAGE" ]]; then
echo "" echo ""
print_status "Please enter a meaningful commit message for version $NEW_VERSION:" print_status "Please enter a meaningful commit message for version $NEW_VERSION:"
echo -n "> " echo -n "> "
read -r COMMIT_MESSAGE read -r COMMIT_MESSAGE
fi
# Check if user provided a message # Check if user provided a message
if [[ -z "$COMMIT_MESSAGE" ]]; then if [[ -z "$COMMIT_MESSAGE" ]]; then
print_warning "No commit message provided. Using default message." print_warning "No commit message provided. Using default message."
COMMIT_MESSAGE="Version $NEW_VERSION - Automatic version increment" COMMIT_MESSAGE="Automatic version increment"
fi fi
# Commit changes with user-provided message # Commit changes with user-provided message
@@ -239,7 +258,10 @@ case "${1:-build}" in
;; ;;
*) *)
echo "OTP Cipher Build Script" echo "OTP Cipher Build Script"
echo "Usage: $0 {build|static|clean|install|uninstall|version}" echo "Usage: $0 [-m \"commit message\"] {build|static|clean|install|uninstall|version}"
echo ""
echo "Options:"
echo " -m, --message \"text\" - Specify commit message (skips interactive prompt)"
echo "" echo ""
echo "Commands:" echo "Commands:"
echo " build - Build project with automatic version increment (default)" echo " build - Build project with automatic version increment (default)"
@@ -248,6 +270,11 @@ case "${1:-build}" in
echo " install - Install to system (requires build first)" echo " install - Install to system (requires build first)"
echo " uninstall - Remove from system" echo " uninstall - Remove from system"
echo " version - Generate version files only" echo " version - Generate version files only"
echo ""
echo "Examples:"
echo " $0 build"
echo " $0 -m \"Fixed checksum parsing bug\" build"
echo " $0 --message \"Added new feature\" static"
exit 1 exit 1
;; ;;
esac esac