Compare commits
3 commits
167ddd4579
...
992925b99e
Author | SHA1 | Date | |
---|---|---|---|
Julien Oculi | 992925b99e | ||
Julien Oculi | b426c3f8bc | ||
Julien Oculi | 05add55d5d |
BIN
dist/redmine-csv-loader
vendored
BIN
dist/redmine-csv-loader
vendored
Binary file not shown.
BIN
dist/redmine-csv-loader.exe
vendored
BIN
dist/redmine-csv-loader.exe
vendored
Binary file not shown.
8
main.ts
8
main.ts
|
@ -8,7 +8,7 @@ import { Command } from 'cliffy'
|
||||||
await new Command()
|
await new Command()
|
||||||
.name('redmine-csv-loader')
|
.name('redmine-csv-loader')
|
||||||
.description('Create Redmine users from CSV and add users to a group.')
|
.description('Create Redmine users from CSV and add users to a group.')
|
||||||
.version('0.1.0')
|
.version('0.1.1')
|
||||||
.option('-g, --group <group:string>', 'Name of the group to add users in.')
|
.option('-g, --group <group:string>', 'Name of the group to add users in.')
|
||||||
.option(
|
.option(
|
||||||
'-a, --only-add [only-add:boolean]',
|
'-a, --only-add [only-add:boolean]',
|
||||||
|
@ -23,10 +23,10 @@ await new Command()
|
||||||
{ required: true },
|
{ required: true },
|
||||||
)
|
)
|
||||||
.arguments('<csv:file>')
|
.arguments('<csv:file>')
|
||||||
.action(async ({ group, endpoint, apiKey, onlyAdd }, domain) => {
|
.action(async ({ group, endpoint, apiKey, onlyAdd }, filePath) => {
|
||||||
const redmine = new Redmine({ endpoint, apiKey })
|
const redmine = new Redmine({ endpoint, apiKey })
|
||||||
|
|
||||||
const file = await Deno.readTextFile(domain)
|
const file = await Deno.readTextFile(filePath)
|
||||||
|
|
||||||
const csv = CSV.parse(file.replaceAll(';', ','), {
|
const csv = CSV.parse(file.replaceAll(';', ','), {
|
||||||
skipFirstRow: true,
|
skipFirstRow: true,
|
||||||
|
@ -34,7 +34,7 @@ await new Command()
|
||||||
|
|
||||||
if (!onlyAdd) createUsers(redmine, csv)
|
if (!onlyAdd) createUsers(redmine, csv)
|
||||||
if (group) {
|
if (group) {
|
||||||
appendToGroup(redmine, csv, prompt('Enter a group name ?: ') ?? '')
|
appendToGroup(redmine, csv, group)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.parse()
|
.parse()
|
||||||
|
|
Loading…
Reference in a new issue