Files
antrean-anjungan/tools/generate.sh

34 lines
725 B
Bash

#!/bin/bash
# Handler Generator Script for Unix/Linux/Mac
# Usage: ./generate.sh <handler-name> [methods]
set -e
if [ $# -lt 1 ]; then
echo "Usage: $0 <handler-name> [methods]"
echo "Example: $0 user get post put delete"
echo "Methods: get, post, put, delete (optional, default: get post)"
exit 1
fi
HANDLER_NAME=$1
shift
METHODS=$@
if [ -z "$METHODS" ]; then
METHODS="get post"
fi
echo "Generating handler: $HANDLER_NAME with methods: $METHODS"
echo
# Change to project root directory
cd "$(dirname "$0")/.."
# Run the generator
go run tools/general/generate-handler.go "$HANDLER_NAME" $METHODS
echo
echo "Handler generated successfully!"
echo "Don't forget to run: swag init -g cmd/api/main.go"