feat: export function to mod
This commit is contained in:
parent
a58fda6419
commit
4c9cf502d0
5
mod.ts
5
mod.ts
|
@ -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 ?: ') ?? '')
|
||||||
}
|
}
|
||||||
|
|
|
@ -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[],
|
||||||
) {
|
) {
|
||||||
|
|
Loading…
Reference in a new issue