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 · 11 comments
Open
1 task done

Improve documentation for replace and replace_command #609

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

Comments

@Cyclonit
Copy link
Contributor

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
@Muhammad-Owais-Warsi
Copy link
Contributor

Hi @orhun, for some reason, I don't have clarity on the issue, but I would love to tackle this. Could you please provide more details? Thanks!

@orhun
Copy link
Owner

orhun commented Oct 16, 2024

Hey @Muhammad-Owais-Warsi! You can start off by adding my comment above to the documentation for making things more clear. Also see the replace_command examples in various places to get an idea of what we are trying to improve here :)

@Muhammad-Owais-Warsi
Copy link
Contributor

Muhammad-Owais-Warsi commented Oct 16, 2024

So basically I have to make changes here , as mentioned in the comment by you and @Cyclonit . Like in this command https://git-cliff.org/docs/configuration/git and under the commit_preprocessors, I have to mention about the changelog.postprocessors

@orhun
Copy link
Owner

orhun commented Oct 16, 2024

Yeah, at there and other relevant sections in the documentation. I would recommend trying out this feature for yourself to get a more clear idea about what to do here ;)

@Muhammad-Owais-Warsi
Copy link
Contributor

Hey, I have made some little changes in the documentation addressing the issue mentioned above.

  1. The commit_preprocessors section.

Screenshot from 2024-10-19 14-56-52

  1. In the commit_parsers section.

Screenshot from 2024-10-19 15-01-53

Let me know whether the changes are correct and if any other parts of the documentation need updates. Thanks!

@orhun
Copy link
Owner

orhun commented Oct 22, 2024

We can use "commit message" instead of "commit log". Other than that it seems fine, please send a PR - it is easier to discuss on the changes :)

@Muhammad-Owais-Warsi
Copy link
Contributor

Sure @orhun

@Muhammad-Owais-Warsi
Copy link
Contributor

Muhammad-Owais-Warsi commented Oct 22, 2024

In my PR #928 this test got failed. I tried to ran rustfmt, but no processing took place, but my formatting got passed.

@orhun
Copy link
Owner

orhun commented Oct 24, 2024

That's fine. Can also mention #609 (comment) in your PR?

@Muhammad-Owais-Warsi
Copy link
Contributor

#928

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

3 participants