diff --git a/mod.ts b/mod.ts index 2be5471..fc1c319 100644 --- a/mod.ts +++ b/mod.ts @@ -1,6 +1,8 @@ import { Redmine } from 'bluemine' import * as CSV from 'std:csv' import { CsvEntry } from './type.ts' +import { createUsers } from './src/create_users.ts' +import { appendToGroup } from './src/append_to_group.ts' if (import.meta.main) { const endpoint = Deno.env.get('ENDPOINT') @@ -20,10 +22,13 @@ if (import.meta.main) { const redmine = new Redmine({ endpoint, apiKey }) const file = await Deno.readTextFile( - prompt('Full path of the CSV file ?:') ?? '', + prompt('Full path of the CSV file ?: ') ?? '', ) const csv = CSV.parse(file.replaceAll(';', ','), { skipFirstRow: true, }) as CsvEntry[] + + createUsers(redmine, csv) + appendToGroup(redmine, csv, prompt('Enter a group name ?: ') ?? '') } diff --git a/src/create_users.ts b/src/create_users.ts index 11dc206..021706a 100644 --- a/src/create_users.ts +++ b/src/create_users.ts @@ -2,7 +2,7 @@ import { Redmine } from 'bluemine' import { CsvEntry } from '../type.ts' import { capitalize, log, sanitize, toLogin } from '../utils.ts' -async function createUsers( +export async function createUsers( redmine: Redmine, csv: CsvEntry[], ) {