31 lines
864 B
JavaScript
31 lines
864 B
JavaScript
const { Command } = require('commander');
|
|
const { buildDependencies } = require('./dependencies');
|
|
|
|
function buildCLIDependencies() {
|
|
const appDependencies = buildDependencies();
|
|
|
|
const CreateAppInviteProvider = require('./commands/createAppInvite');
|
|
const createAppInvite = new CreateAppInviteProvider({
|
|
invitesService: appDependencies.services.invitesService,
|
|
}).provide();
|
|
|
|
return { createAppInviteCommand: createAppInvite };
|
|
}
|
|
|
|
function buildCLI({ createAppInviteCommand }) {
|
|
const wipCli = new Command();
|
|
wipCli.version('1.0.0').description('CLI for managing web app tasks');
|
|
|
|
wipCli
|
|
.command('createAppInvite <inviterNpub>')
|
|
.description('Create an invite')
|
|
.action(createAppInviteCommand);
|
|
|
|
return wipCli;
|
|
}
|
|
|
|
const cliDependencies = buildCLIDependencies();
|
|
|
|
const cli = buildCLI(cliDependencies);
|
|
|
|
cli.parse(process.argv);
|