Compare commits
6 commits
Author | SHA1 | Date | |
---|---|---|---|
|
29fc3296bb | ||
|
fdd4c4fc61 | ||
|
374624097c | ||
|
992925b99e | ||
|
b426c3f8bc | ||
|
05add55d5d |
|
@ -2,7 +2,8 @@
|
|||
|
||||
Create Redmine users from CSV and add users to a group.
|
||||
|
||||
⚠️ This project is only a draft, it's working but not intended to be use widely ⚠️
|
||||
⚠️ This project is only a draft, it's working but not intended to be used widely
|
||||
⚠️
|
||||
|
||||
Binaries are placed in `dist/` for x64.
|
||||
|
||||
|
|
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()
|
||||
.name('redmine-csv-loader')
|
||||
.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(
|
||||
'-a, --only-add [only-add:boolean]',
|
||||
|
@ -23,10 +23,10 @@ await new Command()
|
|||
{ required: true },
|
||||
)
|
||||
.arguments('<csv:file>')
|
||||
.action(async ({ group, endpoint, apiKey, onlyAdd }, domain) => {
|
||||
.action(async ({ group, endpoint, apiKey, onlyAdd }, filePath) => {
|
||||
const redmine = new Redmine({ endpoint, apiKey })
|
||||
|
||||
const file = await Deno.readTextFile(domain)
|
||||
const file = await Deno.readTextFile(filePath)
|
||||
|
||||
const csv = CSV.parse(file.replaceAll(';', ','), {
|
||||
skipFirstRow: true,
|
||||
|
@ -34,7 +34,7 @@ await new Command()
|
|||
|
||||
if (!onlyAdd) createUsers(redmine, csv)
|
||||
if (group) {
|
||||
appendToGroup(redmine, csv, prompt('Enter a group name ?: ') ?? '')
|
||||
appendToGroup(redmine, csv, group)
|
||||
}
|
||||
})
|
||||
.parse()
|
||||
|
|
|
@ -13,7 +13,7 @@ export async function createUsers(
|
|||
const { user } = await redmine.users.create({
|
||||
firstname: capitalize(sanitize(firstname)),
|
||||
lastname: capitalize(sanitize(lastname)),
|
||||
mail: mail,
|
||||
mail: mail.toLowerCase(),
|
||||
login,
|
||||
sendCreationMail: true,
|
||||
generatePassword: true,
|
||||
|
|
Loading…
Reference in a new issue