2018-05-31 17:00:31 +08:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @file
|
|
|
|
* @author An Tao
|
|
|
|
* @section LICENSE
|
|
|
|
*
|
|
|
|
* Copyright 2018, An Tao. All rights reserved.
|
|
|
|
* Use of this source code is governed by a MIT license
|
|
|
|
* that can be found in the License file.
|
|
|
|
*
|
2018-11-16 13:26:14 +08:00
|
|
|
* Drogon
|
2018-05-31 17:00:31 +08:00
|
|
|
*
|
|
|
|
*/
|
2018-05-29 13:49:26 +08:00
|
|
|
|
|
|
|
#include "create.h"
|
|
|
|
#include "cmd.h"
|
|
|
|
#include <drogon/DrClassMap.h>
|
|
|
|
#include <iostream>
|
|
|
|
#include <memory>
|
|
|
|
using namespace drogon_ctl;
|
2018-06-07 18:16:30 +08:00
|
|
|
std::string create::detail()
|
|
|
|
{
|
|
|
|
return "Use create command to create some source files of drogon webapp\n"
|
|
|
|
"Usage:drogon_ctl create <view|controller> [-options] <object name>\n"
|
|
|
|
"drogon_ctl create view <csp file name> //create HttpView source files from csp file\n"
|
|
|
|
"drogon_ctl create controller [-s] [-n <namespace>] <class_name> //"
|
|
|
|
"create HttpSimpleController source files\n"
|
2018-11-15 14:31:10 +08:00
|
|
|
"drogon_ctl create controller -h <[namespace::]class_name> //"
|
|
|
|
"create HttpController source files\n"
|
2018-08-22 14:27:45 +08:00
|
|
|
"drogon_ctl create controller -w [-n <namespace>] <class_name> //"
|
2018-09-04 14:50:18 +08:00
|
|
|
"create WebSocketController source files\n"
|
|
|
|
"drogon_ctl create project <project_name> //"
|
2018-10-20 17:35:52 +08:00
|
|
|
"create a project named project_name\n"
|
|
|
|
"drogon_ctl create filter <class_name> //"
|
2018-10-30 18:43:11 +08:00
|
|
|
"create a filter named class_name\n"
|
2018-10-31 16:45:27 +08:00
|
|
|
"drogon_ctl create model <model_path> //"
|
|
|
|
"create model classes in model_path\n";
|
2018-06-07 18:16:30 +08:00
|
|
|
}
|
2018-05-29 13:49:26 +08:00
|
|
|
|
|
|
|
void create::handleCommand(std::vector<std::string> ¶meters)
|
|
|
|
{
|
|
|
|
//std::cout<<"create!"<<std::endl;
|
2018-10-14 15:56:54 +08:00
|
|
|
auto createObjName = parameters[0];
|
|
|
|
createObjName = std::string("create_") + createObjName;
|
|
|
|
parameters[0] = createObjName;
|
2018-05-29 13:49:26 +08:00
|
|
|
exeCommand(parameters);
|
2018-11-16 13:26:14 +08:00
|
|
|
}
|