Skip to content

Commit fcd6e83

Browse files
author
Nikos Vasileiou
authored
Merge pull request #190 from transifex/cli-override-occurrences
CLI: Add override-occurences flag
2 parents e91f249 + 5dd0a50 commit fcd6e83

File tree

6 files changed

+14
-2
lines changed

6 files changed

+14
-2
lines changed

packages/cli/README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ detect and push source content to Transifex
103103
```
104104
USAGE
105105
$ txjs-cli push [PATTERN] [--dry-run] [--fake] [-v] [--purge] [--no-wait] [--token <value>] [--secret <value>] [--append-tags <value>] [--with-tags-only <value>] [--without-tags-only <value>]
106-
[--cds-host <value>] [--do-not-keep-translations] [--override-tags] [--parser auto|i18next|txnativejson] [--key-generator source|hash]
106+
[--cds-host <value>] [--do-not-keep-translations] [--override-tags] [--override-occurrences] [--parser auto|i18next|txnativejson] [--key-generator source|hash]
107107
108108
ARGUMENTS
109109
PATTERN [default: **/*.{js,jsx,ts,tsx,html,vue,pug,ejs}] file pattern to scan for strings
@@ -118,6 +118,7 @@ FLAGS
118118
--key-generator=<option> [default: source] use hashed or source based keys
119119
<options: source|hash>
120120
--no-wait disable polling for upload results
121+
--override-occurrences override occurrences when pushing content
121122
--override-tags override tags when pushing content
122123
--parser=<option> [default: auto] file parser to use
123124
<options: auto|i18next|txnativejson>

packages/cli/src/api/upload.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ async function uploadPhrases(payload, params) {
2121
dry_run: !!params.dry_run,
2222
keep_translations: !params.do_not_keep_translations,
2323
override_tags: !!params.override_tags,
24+
override_occurrences: !!params.override_occurrences,
2425
},
2526
}, {
2627
headers: {

packages/cli/src/commands/push.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ class PushCommand extends Command {
170170
purge: flags.purge,
171171
do_not_keep_translations: flags['do-not-keep-translations'],
172172
override_tags: flags['override-tags'],
173+
override_occurrences: flags['override-occurrences'],
173174
dry_run: flags['dry-run'],
174175
});
175176

@@ -328,6 +329,10 @@ PushCommand.flags = {
328329
description: 'override tags when pushing content',
329330
default: false,
330331
}),
332+
'override-occurrences': Flags.boolean({
333+
description: 'override occurrences when pushing content',
334+
default: false,
335+
}),
331336
parser: Flags.string({
332337
description: 'file parser to use',
333338
default: 'auto',

packages/native/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ params: Object({
317317
// Replace the existing string tags with the tags of this request
318318
overrideTags: Boolean,
319319

320+
// Replace the existing string occurrences with the occurrences of this request
321+
overrideOccurrences: Boolean,
322+
320323
// If true, when wait for processing to be complete before
321324
// resolving this promise
322325
noWait: Boolean,

packages/native/src/TxNative.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,7 @@ export default class TxNative {
300300
* @param {Object} params
301301
* @param {Boolean} params.purge
302302
* @param {Boolean} params.overrideTags
303+
* @param {Boolean} params.overrideOccurrences
303304
* @param {Boolean} params.noWait - do not wait for upload results
304305
* @returns {Object} Data
305306
* @returns {String} Data.jobUrl
@@ -327,6 +328,7 @@ export default class TxNative {
327328
meta: {
328329
purge: !!params.purge,
329330
override_tags: !!params.overrideTags,
331+
override_occurrences: !!params.overrideOccurrences,
330332
},
331333
}, {
332334
headers,

packages/native/src/index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ declare module '@transifex/native' {
9898
};
9999
string: string;
100100
}>,
101-
config?: { noWait: boolean; overrideTags: boolean; purge: boolean }
101+
config?: { noWait: boolean; overrideTags: boolean; overrideOccurrences: boolean; purge: boolean }
102102
): Promise<{
103103
created: number;
104104
deleted: number;

0 commit comments

Comments
 (0)