#!/bin/bash

read -p "请输入需要文件的类型(1.controller, 2.filters,3.plugins):" TYPE
case $TYPE in
    1) echo "Create controller"
       read -p "请输入controller的名字:" NAME
       drogon_ctl create controller -h api::v1::$NAME
       mv *$NAME*.h ../source/controllers/include/
       mv *$NAME*.cc ../source/controllers/src/
       echo "Create $NAME complete!"
    ;;
    2) echo "Create filters"
       read -p "请输入filters的名字:" NAME
       dg_ctl create filter $NAME
       mv *.h ../source/filters/include/
       mv *.cc ../source/filters/src/
       echo "Create $NAME complete!"
    ;;
    3) echo "Create plugin"
       read -p "请输入plugin的名字:" NAME
       dg_ctl create plugin $NAME
       mv $NAME.h ../source/plugins/include/$NAME.hpp
       mv $NAME.cc ../source/plugins/src/$NAME.cpp
       echo "Create $NAME complete!"
    ;;
esac
