@mongez/gnz
Version:
Generator Z, the next generation of scaffolding tools.
35 lines (34 loc) • 1.96 kB
JavaScript
;var commander=require('commander'),path=require('path'),index=require('../../index.js'),main=require('../../../../../main.js');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var path__default=/*#__PURE__*/_interopDefault(path);const newWarlockRepositoryCommand = new commander.Command("warlock:repository")
.arguments("<name>")
.requiredOption("-p, --path <path>", "Path to save the file to, relative to the project root")
.option("-m, --model <model>", "Model name, if not provided, it will be generated from the repository name")
.option("-mp, --modelPath <modelPath>", "Model path, if not provided, it will be generated from the repository name")
.option("-c, --className <className>", "Class name, if not provided, it will be generated from the repository name")
.option("-e, --exportName <exportName>", "Export name, if not provided, it will be generated from the repository name")
.option("-f, --filters <filters>", "Filters, email:like,id:int,name:=")
.option("-f, --fileName <fileName>", "File name")
.action(async (name, options) => {
const { path, fileName, filters, className, model, modelPath, exportName } = options;
const filtersKeysList = {};
if (filters) {
const keys = filters.split(",");
keys.forEach(key => {
const [keyName, keyType] = key.split(":");
if (!keyName)
return;
if (!keyType)
return;
filtersKeysList[keyName] = keyType;
});
}
await main.gnz.execute(index.generateWarlockRepository.execute({
name,
saveTo: path__default.default.resolve(process.cwd(), path || ""),
fileName,
filters: filtersKeysList,
className,
model,
modelPath,
exportName,
}));
});exports.newWarlockRepositoryCommand=newWarlockRepositoryCommand;//# sourceMappingURL=new-warlock-repository-command.js.map