diff --git a/main.ts b/main.ts index a1b2801..608b110 100644 --- a/main.ts +++ b/main.ts @@ -10,6 +10,10 @@ await new Command() .description('Create Redmine users from CSV and add users to a group.') .version('0.1.0') .option('-g, --group ', 'Name of the group to add users in.') + .option( + '-o, --only-add [only-add:boolean]', + "Don't create users, only add them to a group", + ) .option('-d, --endpoint ', 'Redmine server address.', { default: 'https://projets.cohabit.fr/redmine', }) @@ -19,7 +23,7 @@ await new Command() { required: true }, ) .arguments('') - .action(async ({ group, endpoint, apiKey }, domain) => { + .action(async ({ group, endpoint, apiKey, onlyAdd }, domain) => { const redmine = new Redmine({ endpoint, apiKey }) const file = await Deno.readTextFile(domain) @@ -28,7 +32,7 @@ await new Command() skipFirstRow: true, }) as CsvEntry[] - createUsers(redmine, csv) + if (!onlyAdd) createUsers(redmine, csv) if (group) { appendToGroup(redmine, csv, prompt('Enter a group name ?: ') ?? '') }