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

Improve documentation for replace and replace_command #609

Open
1 task done
Cyclonit opened this issue Apr 13, 2024 · 1 comment
Open
1 task done

Improve documentation for replace and replace_command #609

Cyclonit opened this issue Apr 13, 2024 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@Cyclonit
Copy link

Is there an existing issue or pull request for this?

  • I have searched the existing issues and pull requests

Feature description

changelog.postprocessors and git.commit_preprocessors work on the entire changelog or git message respectively. The documentation does not clearly describe this. As a first time user, one might expect that either processor only affects the part of the input that actually matches the pattern.

For example, a postprocessor like the following would be expected to replace all occurrences of <REPO> with https://github.com/orhun/git-cliff. It replaces the entire changelog instead.

postprocessors = [
  { pattern = '<REPO>', replace_template = 'https://github.com/orhun/git-cliff' }
]

Desired solution

The documentation should be revised in all places to clearly state that pattern does not limit the scope of the replacement, but instead is only used to check if a given string is supposed to replaced entirely.

Alternatives considered

None

Additional context

No response

@Cyclonit Cyclonit added the feature/request New feature or request label Apr 13, 2024
@orhun orhun added documentation Improvements or additions to documentation good first issue Good for newcomers and removed feature/request New feature or request labels Apr 13, 2024
@orhun
Copy link
Owner

orhun commented Apr 13, 2024

Agreed. We can also mention something like:

{ pattern = '.*', replace_command = 'typos --write-changes -' }

is the equivalent of:

echo "<matched_part_of_the_changelog>" | typos --write-changes -

Marked as good first issue, feel free to tackle this as well!

@orhun orhun changed the title improve documentation for replace and replace_command Improve documentation for replace and replace_command Apr 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants