feat: add comment support to flags-dir files #2399
Open
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.
What does this PR do?
This PR adds support for comments in flags-dir files. (The flags-dir functionality is documented here: Salesforce CLI Setup Guide / Salesforce CLI Configuration and Tips / Specify Flag Values in Files.)
Allowing comments will improve usability and maintainability of flag configuration files. With this change, users will be able to add full-line comments that start with
#
or//
to document their flag configurations without affecting CLI behavior.Acceptance Criteria
#
or//
(and nothing but whitespace before that) are filtered out from non-".json" filesTesting Notes
Checklist
What issues does this PR fix or reference?
This PR does not fix any existing issue logged at https://github.com/forcedotcom/cli/issues.
The general issue that this PR helps fix is that the specifics of how the flags-dir is being used is difficult to document and understand.
For example: It can be difficult for reviewers to understand why specific paths are included in flags-dir files. A reviewer may ask: 'Why does your source-dir file contain this path?' If this PR is accepted, then developers will be able to add comments above each path to provide immediate context for reviewers.
Another example: Comments help document requirements for different deployment scenarios. For instance, when setting up multiple flags-dir directories for separate deployments, comments can clarify which paths belong in each file. (For an example of when multiple deployments are required, see the Salesforce Help Article 'Deploying OmniStudio Components with Other Objects Causes an Exception'.)
Also:
--flags-dir
multi-rows flags file with CRLF newline forcedotcom/cli#3236 - "Error parsing --flags-dir multi-rows flags file with CRLF newline"