Skip to content

Commit

Permalink
Merge pull request #190 from transifex/cli-override-occurrences
Browse files Browse the repository at this point in the history
CLI: Add override-occurences flag
  • Loading branch information
Nikos Vasileiou authored Jul 5, 2023
2 parents e91f249 + 5dd0a50 commit fcd6e83
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 2 deletions.
3 changes: 2 additions & 1 deletion packages/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ detect and push source content to Transifex
```
USAGE
$ 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>]
[--cds-host <value>] [--do-not-keep-translations] [--override-tags] [--parser auto|i18next|txnativejson] [--key-generator source|hash]
[--cds-host <value>] [--do-not-keep-translations] [--override-tags] [--override-occurrences] [--parser auto|i18next|txnativejson] [--key-generator source|hash]
ARGUMENTS
PATTERN [default: **/*.{js,jsx,ts,tsx,html,vue,pug,ejs}] file pattern to scan for strings
Expand All @@ -118,6 +118,7 @@ FLAGS
--key-generator=<option> [default: source] use hashed or source based keys
<options: source|hash>
--no-wait disable polling for upload results
--override-occurrences override occurrences when pushing content
--override-tags override tags when pushing content
--parser=<option> [default: auto] file parser to use
<options: auto|i18next|txnativejson>
Expand Down
1 change: 1 addition & 0 deletions packages/cli/src/api/upload.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ async function uploadPhrases(payload, params) {
dry_run: !!params.dry_run,
keep_translations: !params.do_not_keep_translations,
override_tags: !!params.override_tags,
override_occurrences: !!params.override_occurrences,
},
}, {
headers: {
Expand Down
5 changes: 5 additions & 0 deletions packages/cli/src/commands/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class PushCommand extends Command {
purge: flags.purge,
do_not_keep_translations: flags['do-not-keep-translations'],
override_tags: flags['override-tags'],
override_occurrences: flags['override-occurrences'],
dry_run: flags['dry-run'],
});

Expand Down Expand Up @@ -328,6 +329,10 @@ PushCommand.flags = {
description: 'override tags when pushing content',
default: false,
}),
'override-occurrences': Flags.boolean({
description: 'override occurrences when pushing content',
default: false,
}),
parser: Flags.string({
description: 'file parser to use',
default: 'auto',
Expand Down
3 changes: 3 additions & 0 deletions packages/native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,9 @@ params: Object({
// Replace the existing string tags with the tags of this request
overrideTags: Boolean,

// Replace the existing string occurrences with the occurrences of this request
overrideOccurrences: Boolean,

// If true, when wait for processing to be complete before
// resolving this promise
noWait: Boolean,
Expand Down
2 changes: 2 additions & 0 deletions packages/native/src/TxNative.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ export default class TxNative {
* @param {Object} params
* @param {Boolean} params.purge
* @param {Boolean} params.overrideTags
* @param {Boolean} params.overrideOccurrences
* @param {Boolean} params.noWait - do not wait for upload results
* @returns {Object} Data
* @returns {String} Data.jobUrl
Expand Down Expand Up @@ -327,6 +328,7 @@ export default class TxNative {
meta: {
purge: !!params.purge,
override_tags: !!params.overrideTags,
override_occurrences: !!params.overrideOccurrences,
},
}, {
headers,
Expand Down
2 changes: 1 addition & 1 deletion packages/native/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ declare module '@transifex/native' {
};
string: string;
}>,
config?: { noWait: boolean; overrideTags: boolean; purge: boolean }
config?: { noWait: boolean; overrideTags: boolean; overrideOccurrences: boolean; purge: boolean }
): Promise<{
created: number;
deleted: number;
Expand Down

0 comments on commit fcd6e83

Please sign in to comment.