Skip to content

Commit

Permalink
fix: explicitly set zero exit code
Browse files Browse the repository at this point in the history
  • Loading branch information
m90 committed Aug 1, 2024
1 parent 0a6e132 commit fd946ab
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions bin/cmd.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import { pickLanguages, pickKeys } from './../lib/util.js'
import { execCmd } from './../lib/exec.js'

;(async () => {
const [source, target, ...entities] = process.argv.slice(2)
const args = process.argv.slice(2)
const [source, target, ...entities] = args
if (!source || !target || !entities.length) {
throw new Error(
`Expected at least 3 positional arguments to be given, but got ${args.length}, cannot continue.`
)
}

const sourceRepo = new WikibaseRepo(source)
const targetRepo = new WikibaseRepo(target, {
oauth: {
Expand All @@ -27,11 +34,11 @@ import { execCmd } from './../lib/exec.js'
return `Sucessfully transferred ${entities.length} entities from ${source} to ${target}.`
})()
.then((result) => {
if (result) {
console.log(result)
}
console.log(result)
process.exitCode = 0
})
.catch((err) => {
console.error('An error occurred executing the command:')
console.error(err)
process.exitCode = 1
})
Expand Down

0 comments on commit fd946ab

Please sign in to comment.