UNPKG

@gabortorma/mwm

Version:

Multi-repo Workspace Manager

48 lines (40 loc) 1.16 kB
'use strict'; const citty = require('citty'); const git = require('simple-git'); const args = require('../shared/mwm.Bc81aV-e.cjs'); require('node:process'); require('consola'); function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'default' in e ? e.default : e; } const git__default = /*#__PURE__*/_interopDefaultCompat(git); async function addSubmodule(url, dir) { return git__default().submoduleAdd(url, dir); } async function getUrl(url) { return args.getStringArg(url, "Enter the url of the repo"); } async function getDir(dir) { return args.getStringArg(dir, "Enter the dir of the new repo"); } const main = citty.defineCommand({ meta: { name: "generate", description: "Generate new submodule from template" }, args: { url: { alias: "repo", type: "string", description: "Url of the repo of the new submodule" }, dir: { type: "string", description: "Directory to clone the new submodule" } }, async run({ args }) { const url = await getUrl(args.url); const dir = await getDir(args.dir); await addSubmodule(url, dir); } }); exports.main = main;