From fe0366a37fc9a4635a4120c334c01790b3c616e8 Mon Sep 17 00:00:00 2001 From: Stelios Petrakis Date: Thu, 23 Feb 2023 14:50:02 +0100 Subject: [PATCH 1/2] Introduce status filter option in pull command Introduces the `--with-status-only` option that can be provided alongside the existing `--with-tags-only` option and allows users to have better control over which strings will be downloaded from CDS. The `--with-status-only` option accepts a single string that represents the status that the pulled strings must have in order to be downloaded. Points to version 1.0.4 of Transifex SDK so that the CLI tool can have access to the status filter. This commit also improves the documentation of the `hashKeys` option, so that it's clear what the `true` and `false` values do exactly. --- Package.resolved | 4 ++-- Package.swift | 2 +- Sources/TXCli/main.swift | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/Package.resolved b/Package.resolved index 4c33126..2a327f5 100644 --- a/Package.resolved +++ b/Package.resolved @@ -33,8 +33,8 @@ "repositoryURL": "https://github.com/transifex/transifex-swift", "state": { "branch": null, - "revision": "7c1326b1a80fb37923cb4782d63293766ce8ffa7", - "version": "1.0.1" + "revision": "bb5067a395e7343a9c5697bb365baffff3d178f8", + "version": "1.0.4" } } ] diff --git a/Package.swift b/Package.swift index a45af44..8572949 100644 --- a/Package.swift +++ b/Package.swift @@ -15,7 +15,7 @@ let package = Package( dependencies: [ .package(name: "transifex", url: "https://github.com/transifex/transifex-swift", - from: "1.0.1"), + from: "1.0.4"), .package(url: "https://github.com/apple/swift-argument-parser", from: "0.3.0"), .package(url: "https://github.com/kiliankoe/CLISpinner", diff --git a/Sources/TXCli/main.swift b/Sources/TXCli/main.swift index 8791d71..995b480 100644 --- a/Sources/TXCli/main.swift +++ b/Sources/TXCli/main.swift @@ -110,7 +110,8 @@ the CDS server. @Flag(name: .long, inversion: .prefixedEnableDisable, exclusivity: .exclusive, help: """ -Control whether the keys of strings to be pushed should be hashed or not. +Control whether the keys of strings to be pushed should be hashed (true) or not +(false). """) private var hashKeys: Bool = true @@ -327,9 +328,19 @@ will try to create it (alongside any intermediate folders). @Option(name: .long, parsing: .upToNextOption, help: """ If set, only the strings that have all of the given tags will be downloaded. + +This option can be used alongside the --with-status-only option. """) private var withTagsOnly: [String] = [] + @Option(name: .long, help: """ +If set, only the strings that have the provided status assigned will be +downloaded. + +This option can be used alongside the --with-tags-only option. +""") + private var withStatusOnly: String? + func run() throws { let logHandler = CliLogHandler() logHandler.verbose = options.verbose @@ -363,7 +374,8 @@ If set, only the strings that have all of the given tags will be downloaded. var appTranslations: [String: TXLocaleStrings] = [:] var appErrors: [Error] = [] - TXNative.fetchTranslations(tags: withTagsOnly) { (fetchedTranslations, errors) in + TXNative.fetchTranslations(tags: withTagsOnly, + status: withStatusOnly) { (fetchedTranslations, errors) in appErrors = errors appTranslations = fetchedTranslations semaphore.signal() From b49d234bb4b091f7a3b9d9437bfe185855b3c17b Mon Sep 17 00:00:00 2001 From: Stelios Petrakis Date: Thu, 23 Feb 2023 14:51:30 +0100 Subject: [PATCH 2/2] Bump version to 1.0.6 * Bumps CLI version to 1.0.6. * Updates the CHANGELOG. --- CHANGELOG.md | 5 +++++ Sources/TXCli/main.swift | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b7fe1d..e938423 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -63,3 +63,8 @@ argument of the push command. - Allows users to enter a `.xcworkspace` as a `project` argument and handles it correctly. +## Transifex Command Line Tool 1.0.6 + +*February 23, 2023* + +- Introduces status filter option in pull command. diff --git a/Sources/TXCli/main.swift b/Sources/TXCli/main.swift index 995b480..ba13c34 100644 --- a/Sources/TXCli/main.swift +++ b/Sources/TXCli/main.swift @@ -42,7 +42,7 @@ that can be bundled with the iOS application. The tool can be also used to force CDS cache invalidation so that the next pull command will fetch fresh translations from CDS. """, - version: "1.0.5", + version: "1.0.6", subcommands: [Push.self, Pull.self, Invalidate.self]) }