Skip to content

Commit

Permalink
fix: only add punctuation when not already present
Browse files Browse the repository at this point in the history
  • Loading branch information
adamtabrams committed Sep 22, 2021
1 parent 1d2f045 commit 3d6ea23
Show file tree
Hide file tree
Showing 9 changed files with 90 additions and 3 deletions.
2 changes: 1 addition & 1 deletion change
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ fmt_commits() {
for commit in $all_commits; do
first_char=$(echo "$commit" | cut -c 1 | tr "[:lower:]" "[:upper:]")

echo "$commit" | sed -e "s|^.\(.*$\)|- $first_char\1.|"
echo "$commit" | sed -e "s|^.\(.*$\)|- $first_char\1|" -e 's|\(.*[^.!?]\)$|\1.|'
done
}

Expand Down
32 changes: 32 additions & 0 deletions tests/change-punctuation/setup/CHANGELOG-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.2.1] - ~~SUB-DATE~~
### Fixed
- Add fifth file.

## [0.2.0] - ~~SUB-DATE~~
### Added
- Add fourth file!!

## [0.1.1] - ~~SUB-DATE~~
### Fixed
- Add third file.

## [0.1.0] - 2021-01-19
### Added
- Add first file.

### Fixed
- Add second file.

[Unreleased]: https://github.com/adamtabrams/change/compare/0.2.1...HEAD
[0.2.1]: https://github.com/adamtabrams/change/compare/0.2.0...0.2.1
[0.2.0]: https://github.com/adamtabrams/change/compare/0.1.1...0.2.0
[0.1.1]: https://github.com/adamtabrams/change/compare/0.1.0...0.1.1
[0.1.0]: https://github.com/adamtabrams/change/releases/tag/0.1.0
17 changes: 17 additions & 0 deletions tests/change-punctuation/setup/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.0] - 2021-01-19
### Added
- Add first file.

### Fixed
- Add second file.

[Unreleased]: https://github.com/adamtabrams/change/compare/0.1.0...HEAD
[0.1.0]: https://github.com/adamtabrams/change/releases/tag/0.1.0
Empty file.
3 changes: 3 additions & 0 deletions tests/change-punctuation/setup/exp-stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
added 0.1.1 to CHANGELOG.md
added 0.2.0 to CHANGELOG.md
added 0.2.1 to CHANGELOG.md
9 changes: 9 additions & 0 deletions tests/change-punctuation/setup/results
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh

. ../../.test-resources.sh

compare_stdout
compare_stderr

gen_changelog_exp
compare_changelog
26 changes: 26 additions & 0 deletions tests/change-punctuation/setup/run-test
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/sh

git init --quiet

git add run-test
git commit --quiet -am "feat: add first file"
git add results
git commit --quiet -am "fix: add second file"
git tag 0.1.0

git add exp-stderr
git commit --quiet -am "fix: add third file."
git tag 0.1.1

git add exp-stdout
git commit --quiet -am "feat: add fourth file!!"
git tag 0.2.0

git add CHANGELOG.md
git commit --quiet -am "fix: add fifth file"

git remote add origin https://github.com/adamtabrams/change.git

change >act-stdout 2>act-stderr

rm -rf ./.git
2 changes: 1 addition & 1 deletion tests/change-symbols/setup/CHANGELOG-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- (paren pair) {curly pair} [square pair].
- Website https://github.com/adamtabrams.
- Asterisk * escaped asterisk \*.
- Four backslashes \ exclamation !.
- Exclamation ! four backslashes \.
- 'apostrophe pair' `escaped tick pair`.
- Tilda ~ escaped tick ` ampersand &.

Expand Down
2 changes: 1 addition & 1 deletion tests/change-symbols/setup/run-test
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ git rm --quiet --cached exp-stderr
git commit --quiet -am "chore: single backslash \ escaped backslash \\ "

git add exp-stderr
git commit --quiet -am "fix: four backslashes \\\\ exclamation !"
git commit --quiet -am "fix: exclamation ! four backslashes \\\\"
git rm --quiet --cached exp-stderr
git commit --quiet -am 'chore: colon exclamation :! "quote pair"'

Expand Down

0 comments on commit 3d6ea23

Please sign in to comment.