-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New command
mycli files end-of-line
(#16)
* Add command "files end-of-line" * Fix doc * Fix typo * Fix file name
- Loading branch information
1 parent
98ede74
commit fffda97
Showing
7 changed files
with
171 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
##? Display files that don't have exactly one empty line at the end. | ||
##? | ||
##? Usage: | ||
##? files end-of-line [<path>] | ||
##? | ||
##? Options: | ||
##? <path> Path to the directory to search for files [default: .] | ||
|
||
source "${CLI_DIR}/core/helpers.sh" | ||
parse_help "$@" | ||
declare path | ||
|
||
files_to_check=$(find_relevant_files "${path:-.}") | ||
|
||
echo "Files without exactly one empty line at the end:" | ||
found=false | ||
while IFS= read -r file; do | ||
if ! has_exactly_one_line_at_the_end "$file"; then | ||
echo "$file" | ||
found=true | ||
fi | ||
done < <(printf '%s\n' "$files_to_check") | ||
|
||
if [ "$found" = false ]; then | ||
echo_color "gray" "All files have exactly one empty line at the end." | ||
fi | ||
echo_done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
This file doesn't end in a newline character. | ||
It is used in a unit test. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters