@tolgee/cli
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -144,5 +144,6 @@ #!/usr/bin/env node | ||
error('An unexpected error occurred while running the command.'); | ||
exitWithError('Please report this to our issue tracker: https://github.com/tolgee/tolgee-cli/issues'); | ||
error('Please report this to our issue tracker: https://github.com/tolgee/tolgee-cli/issues'); | ||
exitWithError(e); | ||
} | ||
} | ||
run(); |
import { Command, Option } from 'commander'; | ||
import { unzipBuffer } from '../utils/zip.js'; | ||
import { prepareDir } from '../utils/prepareDir.js'; | ||
import { loading, success } from '../utils/logger.js'; | ||
import { exitWithError, loading, success } from '../utils/logger.js'; | ||
import { checkPathNotAFile } from '../utils/checkPathNotAFile.js'; | ||
@@ -29,3 +29,3 @@ import { mapExportFormat } from '../utils/mapExportFormat.js'; | ||
if (!opts.path) { | ||
throw new Error('Missing or option --path <path>'); | ||
exitWithError('Missing option --path <path> or `pull.path` in tolgee config'); | ||
} | ||
@@ -41,3 +41,3 @@ await checkPathNotAFile(opts.path); | ||
.description('Pulls translations from Tolgee') | ||
.addOption(new Option('-p, --path <path>', 'Destination of a folder where translation files will be stored in').default(config.pull?.path)) | ||
.addOption(new Option('--path <path>', 'Destination of a folder where translation files will be stored in').default(config.pull?.path)) | ||
.addOption(new Option('-l, --languages <languages...>', 'List of languages to pull. Leave unspecified to export them all').default(config.pull?.languagess)) | ||
@@ -44,0 +44,0 @@ .addOption(new Option('-s, --states <states...>', 'List of translation states to include. Defaults all except untranslated') |
@@ -77,3 +77,3 @@ import { extname, join } from 'path'; | ||
if (!config.push?.files) { | ||
throw new Error('Missing option `push.files` in configuration file.'); | ||
exitWithError('Missing option `push.files` in configuration file.'); | ||
} | ||
@@ -80,0 +80,0 @@ const filteredMatchers = config.push.files.filter((r) => { |
@@ -62,7 +62,17 @@ import { getStackTrace } from './getStackTrace.js'; | ||
} | ||
export function exitWithError(msg) { | ||
error(msg); | ||
if (debugEnabled) { | ||
console.log(getStackTrace()); | ||
export function exitWithError(err) { | ||
let message; | ||
let stack; | ||
if (err instanceof Error) { | ||
message = err.message; | ||
stack = err.stack; | ||
} | ||
else { | ||
message = err; | ||
stack = getStackTrace(); | ||
} | ||
error(message); | ||
if (debugEnabled && stack) { | ||
console.log(stack); | ||
} | ||
process.exit(1); | ||
@@ -69,0 +79,0 @@ } |
{ | ||
"name": "@tolgee/cli", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "description": "A tool to interact with the Tolgee Platform through CLI", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
921516
4892