2018-05-31 17:00:31 +08:00
|
|
|
/**
|
|
|
|
*
|
2020-10-12 21:51:39 +08:00
|
|
|
* @file create.cc
|
|
|
|
* @author An Tao
|
2018-05-31 17:00:31 +08:00
|
|
|
*
|
|
|
|
* Copyright 2018, An Tao. All rights reserved.
|
2018-12-07 15:50:18 +08:00
|
|
|
* https://github.com/an-tao/drogon
|
2018-05-31 17:00:31 +08:00
|
|
|
* 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()
|
|
|
|
{
|
2019-03-09 10:31:58 +08:00
|
|
|
return "Use create command to create some source files of drogon webapp\n\n"
|
2019-05-18 20:39:57 +08:00
|
|
|
"Usage:drogon_ctl create <view|controller|filter|project|model> "
|
|
|
|
"[-options] <object name>\n\n"
|
2020-10-09 21:41:27 +08:00
|
|
|
"drogon_ctl create view <csp file name> [-o <output path>] [-n "
|
2022-06-03 15:40:24 +08:00
|
|
|
"<namespace>] [--path-to-namespace] //create HttpView source files "
|
|
|
|
"from csp files, namespace is prefixed of path-to-namespace\n\n"
|
2018-12-15 21:21:39 +08:00
|
|
|
"drogon_ctl create controller [-s] <[namespace::]class_name> //"
|
2018-12-15 21:37:08 +08:00
|
|
|
"create HttpSimpleController source files\n\n"
|
2018-11-15 14:31:10 +08:00
|
|
|
"drogon_ctl create controller -h <[namespace::]class_name> //"
|
2018-12-15 21:37:08 +08:00
|
|
|
"create HttpController source files\n\n"
|
2018-12-15 21:21:39 +08:00
|
|
|
"drogon_ctl create controller -w <[namespace::]class_name> //"
|
2018-12-15 21:37:08 +08:00
|
|
|
"create WebSocketController source files\n\n"
|
2019-09-30 21:34:30 +08:00
|
|
|
"drogon_ctl create controller -r <[namespace::]class_name> "
|
|
|
|
"[--resource=...]//"
|
|
|
|
"create restful controller source files\n\n"
|
2019-03-09 10:31:58 +08:00
|
|
|
"drogon_ctl create filter <[namespace::]class_name> //"
|
2018-12-15 21:37:08 +08:00
|
|
|
"create a filter named class_name\n\n"
|
2019-03-29 15:34:14 +08:00
|
|
|
"drogon_ctl create plugin <[namespace::]class_name> //"
|
|
|
|
"create a plugin named class_name\n\n"
|
2018-12-15 21:37:08 +08:00
|
|
|
"drogon_ctl create project <project_name> //"
|
|
|
|
"create a project named project_name\n\n"
|
2019-09-30 21:34:30 +08:00
|
|
|
"drogon_ctl create model <model_path> [--table=<table_name>] [-f]//"
|
2018-10-31 16:45:27 +08:00
|
|
|
"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)
|
|
|
|
{
|
2019-05-18 20:39:57 +08:00
|
|
|
// 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
|
|
|
}
|