Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).

## [Unreleased]

### Changed

- Standardized spacing in `head` and `tail` commands across scripts and Makefile for consistency (#90).

## [3.1.2] - 2025-11-11

### Fixed
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,9 @@ compile:
@ # Insert default datapath variable into $(PROG)
@ echo -n "Compiling command file ..."
@ { \
head -n1 $(PROG); \
head -n 1 $(PROG); \
echo "$(DATAPATHVAR)=\"$(SHAREPATH)/$(PROG)\""; \
tail -n+2 $(PROG); \
tail -n +2 $(PROG); \
} > $(COMPILEDIR)/$(PROG)
@ chmod +x $(COMPILEDIR)/$(PROG)
@ echo DONE
Expand All @@ -84,7 +84,7 @@ compile:
echo -n "\"Version "; echo -n $$(cat $(VERFILE)); echo -n "\" "; \
echo; \
} > $(COMPILEDIR)/$(MANFILE)
@ sed 's/`\([^`]\+\)<\([^>]\+\)>`__/\1\n \2/g' $(MANRST) | $(RST2MAN) | tail -n+33 >> $(COMPILEDIR)/$(MANFILE)
@ sed 's/`\([^`]\+\)<\([^>]\+\)>`__/\1\n \2/g' $(MANRST) | $(RST2MAN) | tail -n +33 >> $(COMPILEDIR)/$(MANFILE)
@ echo DONE

@ # Copy README and MAN rst into COMPILEDIR
Expand Down Expand Up @@ -144,10 +144,10 @@ distsingle:
@ echo -n "Compiling single script ..."
@ # Insert content of $(USAGEFILE) and $(VERFILE) into $(PROG) as variables
@ { \
head -n1 $(PROG); \
head -n 1 $(PROG); \
echo "$(USAGEVAR)=\"$$(cat $(USAGEFILE))\""; \
echo "$(VERSIONVAR)=\"$$(cat $(VERFILE))\""; \
tail -n+2 $(PROG); \
tail -n +2 $(PROG); \
} > $(PROGSINGLE)
@ chmod +x $(PROGSINGLE)
@ echo DONE
Expand Down
12 changes: 6 additions & 6 deletions flow
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ main() {
}

top_vertag() {
git tag --list | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$" | sort -V | tail -1 | tr -d v
git tag --list | grep -E "^v[0-9]+\.[0-9]+\.[0-9]+$" | sort -V | tail -n 1 | tr -d v
}

git_merge_nocommit() {
Expand Down Expand Up @@ -467,7 +467,7 @@ main() {
}

version_lte() {
[[ "${1}" == "$(echo -e "${1}\n${2}" | sort -V | head -n1)" ]]
[[ "${1}" == "$(echo -e "${1}\n${2}" | sort -V | head -n 1)" ]]
}

validate_requirements() {
Expand Down Expand Up @@ -1221,16 +1221,16 @@ main() {

flow_usage() {
local file head tail
head="$(echo "${USAGE:-}" | head -n1)"
tail="$(echo "${USAGE:-}" | tail -n+2)"
head="$(echo "${USAGE:-}" | head -n 1)"
tail="$(echo "${USAGE:-}" | tail -n +2)"
file="${DATAPATH}/${SCRIPT_NAME}.usage"
[[ -z "${head}" ]] \
&& [[ ! -f "${file}" ]] \
&& echo 'Usage is not available in source file.' \
&& return
[[ -z "${head}" ]] \
&& head="$(head -n1 "${file}")" \
&& tail="$(tail -n+2 "${file}")"
&& head="$(head -n 1 "${file}")" \
&& tail="$(tail -n +2 "${file}")"
echo "${head}"
echo
local indent=0
Expand Down
36 changes: 18 additions & 18 deletions test/test.butt
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ function checkInitFiles {
assert_equal "$(git show "${1:-main}":VERSION)" "0.0.0"
assert_equal "$(git show staging:VERSION)" "0.0.0"
assert_equal "$(git show "${1:-main}"-0:VERSION)" "0.0.0"
assert_equal "$(head -n1 CHANGELOG.md)" "# Change Log"
assert_equal "$(head -n 1 CHANGELOG.md)" "# Change Log"
}

function grep_log {
Expand Down Expand Up @@ -420,8 +420,8 @@ start "merge feature"
assert_contains "${log}" "Update changelog"
assert_contains "${loglines[0]}" "(HEAD -> dev) Merge branch 'myfeature' into dev"
assert_equal "$(git show-ref | grep /refs/heads/feature-myfeature)" ""
assert_equal "$(git show dev:CHANGELOG.md | head -9 | tail -1)" "### Added"
assert_equal "$(git show dev:CHANGELOG.md | head -11 | tail -1)" "- feature1"
assert_equal "$(git show dev:CHANGELOG.md | head -n 9 | tail -n 1)" "### Added"
assert_equal "$(git show dev:CHANGELOG.md | head -n 11 | tail -n 1)" "- feature1"
assert_equal "$(gsp)" ""
debug "flow -n"
assert_equal "${status}" 0
Expand Down Expand Up @@ -484,9 +484,9 @@ start "create staging"
assert_equal "${status}" 0
assert_equal "$(git show dev:VERSION)" "0.2.0"
assert_equal "$(git show staging:VERSION)" "0.1.0"
assert_equal "$(git show dev:CHANGELOG.md | head -7 | tail -1)" "## [Unreleased]"
assert_contains "$(git show dev:CHANGELOG.md | head -9 | tail -1)" "## [0.1.0-rc.1] - "
assert_contains "$(git show staging:CHANGELOG.md | head -7 | tail -1)" "## [0.1.0-rc.1] - "
assert_equal "$(git show dev:CHANGELOG.md | head -n 7 | tail -n 1)" "## [Unreleased]"
assert_contains "$(git show dev:CHANGELOG.md | head -n 9 | tail -n 1)" "## [0.1.0-rc.1] - "
assert_contains "$(git show staging:CHANGELOG.md | head -n 7 | tail -n 1)" "## [0.1.0-rc.1] - "
assert_contains "$(git show-ref)" "refs/heads/staging"
assert_equal "$(gsp)" ""
debug "flow -n"
Expand All @@ -503,11 +503,11 @@ start "create rc2"
assert_equal "${status}" 0
assert_equal "$(git show dev:VERSION)" "0.2.0"
assert_equal "$(git show staging:VERSION)" "0.1.0"
assert_equal "$(git show dev:CHANGELOG.md | head -7 | tail -1)" "## [Unreleased]"
assert_contains "$(git show dev:CHANGELOG.md | head -9 | tail -1)" "## [0.1.0-rc.2] - "
assert_contains "$(git show dev:CHANGELOG.md | head -11 | tail -1)" "## [0.1.0-rc.1] - "
assert_contains "$(git show staging:CHANGELOG.md | head -7 | tail -1)" "## [0.1.0-rc.2] - "
assert_contains "$(git show staging:CHANGELOG.md | head -9 | tail -1)" "## [0.1.0-rc.1] - "
assert_equal "$(git show dev:CHANGELOG.md | head -n 7 | tail -n 1)" "## [Unreleased]"
assert_contains "$(git show dev:CHANGELOG.md | head -n 9 | tail -n 1)" "## [0.1.0-rc.2] - "
assert_contains "$(git show dev:CHANGELOG.md | head -n 11 | tail -n 1)" "## [0.1.0-rc.1] - "
assert_contains "$(git show staging:CHANGELOG.md | head -n 7 | tail -n 1)" "## [0.1.0-rc.2] - "
assert_contains "$(git show staging:CHANGELOG.md | head -n 9 | tail -n 1)" "## [0.1.0-rc.1] - "
assert_contains "$(git show-ref)" "refs/heads/staging"
assert_equal "$(gsp)" ""
debug "flow -n"
Expand All @@ -525,13 +525,13 @@ start "release rc2"
assert_equal "${status}" 0
assert_equal "$(git show dev:VERSION)" "0.2.0"
assert_equal "$(git show staging:VERSION)" "0.1.0"
assert_equal "$(git show dev:CHANGELOG.md | head -7 | tail -1)" "## [Unreleased]"
assert_contains "$(git show dev:CHANGELOG.md | head -9 | tail -1)" "## [0.1.0] - "
assert_contains "$(git show dev:CHANGELOG.md | head -13 | tail -1)" "## [0.1.0-rc.2] - "
assert_contains "$(git show dev:CHANGELOG.md | head -15 | tail -1)" "## [0.1.0-rc.1] - "
assert_contains "$(git show main:CHANGELOG.md | head -7 | tail -1)" "## [0.1.0] - "
assert_contains "$(git show main:CHANGELOG.md | head -11 | tail -1)" "## [0.1.0-rc.2] - "
assert_contains "$(git show main:CHANGELOG.md | head -13 | tail -1)" "## [0.1.0-rc.1] - "
assert_equal "$(git show dev:CHANGELOG.md | head -n 7 | tail -n 1)" "## [Unreleased]"
assert_contains "$(git show dev:CHANGELOG.md | head -n 9 | tail -n 1)" "## [0.1.0] - "
assert_contains "$(git show dev:CHANGELOG.md | head -n 13 | tail -n 1)" "## [0.1.0-rc.2] - "
assert_contains "$(git show dev:CHANGELOG.md | head -n 15 | tail -n 1)" "## [0.1.0-rc.1] - "
assert_contains "$(git show main:CHANGELOG.md | head -n 7 | tail -n 1)" "## [0.1.0] - "
assert_contains "$(git show main:CHANGELOG.md | head -n 11 | tail -n 1)" "## [0.1.0-rc.2] - "
assert_contains "$(git show main:CHANGELOG.md | head -n 13 | tail -n 1)" "## [0.1.0-rc.1] - "
assert_contains "$(git show-ref)" "refs/heads/dev"
assert_equal "$(gsp)" ""
debug "flow -n"
Expand Down
Loading