UNPKG

@gabortorma/mwm

Version:

Multi-repo Workspace Manager

42 lines (37 loc) 955 B
import { defineCommand } from 'citty'; import git from 'simple-git'; import { g as getStringArg } from '../shared/mwm.CyrEUDRq.mjs'; import 'node:process'; import 'consola'; async function addSubmodule(url, dir) { return git().submoduleAdd(url, dir); } async function getUrl(url) { return getStringArg(url, "Enter the url of the repo"); } async function getDir(dir) { return getStringArg(dir, "Enter the dir of the new repo"); } const main = 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); } }); export { main };