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