2024-01-15 21:01:07 +01:00
|
|
|
import { Redmine } from 'bluemine';
|
|
|
|
import * as CSV from 'std:csv';
|
2024-01-15 21:05:13 +01:00
|
|
|
import { CsvEntry } from './type.ts';
|
2024-01-15 21:01:07 +01:00
|
|
|
|
|
|
|
if (import.meta.main) {
|
|
|
|
const endpoint = Deno.env.get('ENDPOINT')
|
|
|
|
const apiKey = Deno.env.get('API_KEY')
|
|
|
|
|
|
|
|
if (apiKey === undefined) throw new Error('Redmine REST API key is missing, please define API_KEY')
|
|
|
|
if (endpoint === undefined) throw new Error('Redmine REST endpoint is missing, please define ENDPOINT')
|
|
|
|
|
|
|
|
const redmine = new Redmine({ endpoint, apiKey });
|
|
|
|
|
2024-01-15 21:05:13 +01:00
|
|
|
const file = await Deno.readTextFile(prompt('Full path of the CSV file ?:') ?? '');
|
|
|
|
|
2024-01-15 21:01:07 +01:00
|
|
|
const csv = CSV.parse(file.replaceAll(';', ','), {
|
|
|
|
skipFirstRow: true,
|
|
|
|
}) as CsvEntry[];
|
|
|
|
}
|