system/packages/git-modules/dist/commands/commit.js
2024-07-02 21:56:23 +02:00

34 lines
1.3 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.register = void 0;
const debug = require("../debug");
const chalk = require("chalk");
const argv_1 = require("../argv");
const modules_1 = require("../modules");
const dir = require("@xblox/fs/dir");
const options = (yargs) => (0, argv_1.defaultOptions)(yargs.option('command', {
describe: 'the command to run per module'
}).option('message', { describe: 'the commit message' }));
const description = () => {
return 'Run a command for all modules' +
'\n\t Parameters : ' +
chalk.green('\n\t\t\t --command=[command to run]');
};
const register = (cli) => {
return cli.command('list', description(), options, (argv) => {
if (argv.help) {
return;
}
const args = (0, argv_1.sanitize)(argv);
if (args.target) {
dir.sync(args.target);
}
args.command = 'commit';
const modules = (0, modules_1.get)(args.source, args.target, args.profile).map((module) => module.pack());
debug.inspect('modules:', modules);
// const all = each(modules, args, ['commit', '--message=' + argv.message]);
// all.then((r) => debug.inspect('test', r));
});
};
exports.register = register;
//# sourceMappingURL=commit.js.map