Add --print and --format options - #22
Merged
Merged
Conversation
Print the app id, version name and version code of one platform as
read from the native file. Without --format the three values are
listed as key: value lines in the style of --dry-run; with --format
they fill a template, so a composed identifier such as a Sentry
release string comes out of a single call:
--print ios --format '{appId}@{versionName}+{versionCode}'
Only the referenced placeholders are read, so a template without
{appId} keeps working in projects where the app id cannot be resolved.
Values are inserted as written in the native file, like the single-value
--print-* flags print them; unknown placeholders are an error.
The platform switch for reading the app id and the versions moves into
two small helpers shared with readNativeValues.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
--print <platform>with an optional--format <template>. Without a template it lists the three native values in the style of--dry-run; with one, it fills the template, so a composed identifier such as a Sentry release string is a single call:{appId},{versionName}and{versionCode}, matching the library field names. An unknown placeholder fails with the available list; other braces pass through, so there are no escaping rules.{appId}keeps working in projects with flavor-specific application ids where--print-app-idfails.--print-*flags. The character check stays specific to--print-env, where it protectseval.--configurationapplies to{appId}for iOS as with the other flags.--formatwithout--printis an error.--print-envshown after it for scripts that need several values.Internally the platform switch for reading the app id and versions moved into two helpers shared with
readNativeValues;formatTemplateis exported alongsideformatEnv.