Skip to content

Commit

Permalink
update last PR missing flag extension (#75)
Browse files Browse the repository at this point in the history
# Description
### Summary:

Add missing detail `sed -i<extension>` for portability linux/macOsx
issue






---

# Checklist:

### Code related
- [x] I have made corresponding changes to the documentation (i.e.:
function/class, script header, README.md)
- [ ] I have commented hard-to-understand code 
- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] All tests pass locally with my changes (Check `tests/README.md`
for local testing procedure)
- [x] My commit messages follow the [conventional
commits](https://www.conventionalcommits.org) specification. See
`commit_msg_reference.md` in the repository root for details

### PR creation related 
- [x] My pull request `base ref` branch is set to the `dev` branch (the
_build-system_ won't be triggered otherwise)
- [x] My pull request branch is up-to-date with the `dev` branch (the
_build-system_ will reject it otherwise)

### PR description related 
- [x] I have included a quick summary of the changes
- [x] I have indicated the related issue's id with `# <issue-id>` if
changes are of type `fix`

 ## Note for repository admins
 ### Release PR related
- Only repository admins have the privilege to `push/merge` on the
default branch (ie: `main`) and the `release` branch.
- Keep PR in `draft` mode until all the release reviewers are ready to
push the release.
- Once a PR from `release` -> `main` branch is created (not in draft
mode), it triggers the _build-system_ test
- On merge to the `main` branch, it triggers the _semantic-release
automation_
  • Loading branch information
RedLeader962 authored Jan 24, 2024
2 parents 4f95127 + 843f418 commit 76f4d31
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
Automatically generated by semantic-release

## [2.1.3](https://github.com/norlab-ulaval/norlab-shell-script-tools/compare/v2.1.2...v2.1.3) (2024-01-24)


### Bug Fixes

* make portable seek_and_modify_string_in_file (mac OsX) ([c19a80a](https://github.com/norlab-ulaval/norlab-shell-script-tools/commit/c19a80a89153760413e7f931b7f9caebc3673c3e))
* make portable seek_and_modify_string_in_file (mac OsX) ([#74](https://github.com/norlab-ulaval/norlab-shell-script-tools/issues/74)) ([d94064c](https://github.com/norlab-ulaval/norlab-shell-script-tools/commit/d94064c3674fdc3e3bdbcc788f3ffded3cbcfc08))

## [2.1.2](https://github.com/norlab-ulaval/norlab-shell-script-tools/compare/v2.1.1...v2.1.2) (2024-01-22)


Expand Down
5 changes: 3 additions & 2 deletions src/function_library/general_utilities.bash
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ function n2st::seek_and_modify_string_in_file() {

# Note:
# - Character ';' is used as a delimiter
# - Keep -i flag for portability to Mac OsX
sudo sed -i "s;${TMP_SEEK};${TMP_CHANGE_FOR};" "${TMP_FILE_PATH}"
# - Keep -i flag for portability to Mac OsX (it's analogue to --in-place flag)
# - .bak is the backup extension convention and is required by -i
sudo sed -i.bak "s;${TMP_SEEK};${TMP_CHANGE_FOR};" "${TMP_FILE_PATH}" && rm "${TMP_FILE_PATH}.bak"

}

Expand Down
3 changes: 3 additions & 0 deletions tests/test_general_utilities.bats
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ teardown() {

run n2st::seek_and_modify_string_in_file "${LOOKUP_STR}.*" "${MODIFIED_STR}" "$TMP_TEST_FILE"
assert_success

assert_file_exist "${TMP_TEST_FILE}"

run n2st::preview_file_in_promt "$TMP_TEST_FILE"
assert_output --partial "${UNCHANGED_STR}"
refute_output --partial "${ORIGINAL_STR}"
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.1.2
2.1.3

0 comments on commit 76f4d31

Please sign in to comment.