Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve --keep-translations argument issue #31

Merged
merged 3 commits into from
Mar 7, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Resolve --keep-translations argument issue
The `--keep-translations` argument of the `push` command was a boolean
flag that had a default value of `true`. This meant that if user did
not supply the `--keep-translations` argument to their `push` command
the value would be `true` and if they did, the value would also be
`true`, making it impossible for the `--keep-translations` flag to be
false.

In order to fix the issue, the argument has been replaced with the
inverse flag: `--delete-translations`. Its default value is `false` so
it behaves exactly as the `--keep-translations` before, if the argument
was not supplied (`keep_translations` is going to be set to `true`).

The difference is that now if this new argument is supplied, then the
underlying value of the `keep_translations` metadata will be `false`.
stelabouras committed Mar 7, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit 3abb9bb03cac6f87ee5fc64143b0567a0afa7e11
12 changes: 6 additions & 6 deletions Sources/TXCli/main.swift
Original file line number Diff line number Diff line change
@@ -143,13 +143,13 @@ content to occurrences of existing strings instead of overwriting them.
private var overrideOccurrences: Bool = false

@Flag(name: .long, help: """
If keep-translations: true (default), then preserve translations on source
content updates.

If keep-translations: false, then delete translations on source string content
If delete-translations: true, then delete translations on source string content
updates.

If delete-translations: false (default), then preserve translations on source
content updates.
""")
private var keepTranslations: Bool = true
private var deleteTranslations: Bool = false

@Flag(name: .long, help: """
Emulate a content push, without doing actual changes.
@@ -293,7 +293,7 @@ Emulate a content push, without doing actual changes.
let configuration = TXPushConfiguration(purge: purge,
overrideTags: overrideTags,
overrideOccurrences: overrideOccurrences,
keepTranslations: keepTranslations,
keepTranslations: !deleteTranslations,
dryRun: dryRun)

logHandler.verbose("Push configuration: \(configuration.debugDescription)")