feat: export function to mod

This commit is contained in:
Julien Oculi 2024-01-15 22:54:55 +01:00
parent a58fda6419
commit 4c9cf502d0
2 changed files with 7 additions and 2 deletions

5
mod.ts
View file

@ -1,6 +1,8 @@
import { Redmine } from 'bluemine' import { Redmine } from 'bluemine'
import * as CSV from 'std:csv' import * as CSV from 'std:csv'
import { CsvEntry } from './type.ts' import { CsvEntry } from './type.ts'
import { createUsers } from './src/create_users.ts'
import { appendToGroup } from './src/append_to_group.ts'
if (import.meta.main) { if (import.meta.main) {
const endpoint = Deno.env.get('ENDPOINT') const endpoint = Deno.env.get('ENDPOINT')
@ -26,4 +28,7 @@ if (import.meta.main) {
const csv = CSV.parse(file.replaceAll(';', ','), { const csv = CSV.parse(file.replaceAll(';', ','), {
skipFirstRow: true, skipFirstRow: true,
}) as CsvEntry[] }) as CsvEntry[]
createUsers(redmine, csv)
appendToGroup(redmine, csv, prompt('Enter a group name ?: ') ?? '')
} }

View file

@ -2,7 +2,7 @@ import { Redmine } from 'bluemine'
import { CsvEntry } from '../type.ts' import { CsvEntry } from '../type.ts'
import { capitalize, log, sanitize, toLogin } from '../utils.ts' import { capitalize, log, sanitize, toLogin } from '../utils.ts'
async function createUsers( export async function createUsers(
redmine: Redmine, redmine: Redmine,
csv: CsvEntry[], csv: CsvEntry[],
) { ) {