Skip to content

Commit 8e11237

Browse files
committed
style: format shell files
Apply shfmt output to shell examples and test fixtures, and remove trailing whitespace from the awk script.
1 parent dc65d2d commit 8e11237

24 files changed

Lines changed: 56 additions & 56 deletions

examples/readme-example.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
say-hello() {
3434
if [[ ! "$1" ]]; then
3535
echo "Oups !" >&2
36-
return 1;
36+
return 1
3737
fi
3838

3939
echo "Hello $1"

shdoc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -448,23 +448,23 @@ function render_docblock_list(docblock, docblock_name, title) {
448448
# long_option_regex = "--[[:alnum:]][[:alnum:]-]*((=|[[:blank:]]+)<[^>]+>)?"
449449
# pipe_separator_regex = "([[:blank:]]*\\|?[[:blank:]]+)"
450450
# description_regex = "([^[:blank:]|<-].*)?"
451-
#
451+
#
452452
# # Build regex matching all options
453453
# short_or_long_option_regex = sprintf("(%s|%s)", short_option_regex, long_option_regex)
454-
#
454+
#
455455
# # Build regex matching multiple options separated by spaces or pipe.
456456
# all_options_regex = sprintf("(%s%s)+", short_or_long_option_regex, pipe_separator_regex)
457-
#
457+
#
458458
# # Build final regex.
459459
# optional_arg_regex = sprintf("^(%s)%s$", all_options_regex, description_regex)
460460
# ```
461-
#
461+
#
462462
# Final regex with non-matching groups (unsupported by gawk).
463-
#
463+
#
464464
# `^((?:(?:-[[:alnum:]](?:[[:blank:]]*<[^>]+>)?|--[[:alnum:]][[:alnum:]-]*(?:(?:=|[[:blank:]]+)<[^>]+>)?)(?:[[:blank:]]*\|?[[:blank:]]+))+)([^[:blank:]|<-].*)?$`
465465
#
466466
# @param text The text to process as an @option entry.
467-
#
467+
#
468468
# @set dockblock["option"] A docblock for correctly formated options.
469469
# @set dockblock["option-bad"] A docblock for badly formated options.
470470
function process_at_option(text) {
@@ -764,7 +764,7 @@ in_example {
764764
# Select @arg lines with content.
765765
/^[[:blank:]]*#[[:blank:]]+@arg[[:blank:]]+[^[:blank:]]/ {
766766
debug("→ @arg")
767-
767+
768768
arg_text = $0
769769

770770
# Remove '# @arg ' tag.
@@ -855,9 +855,9 @@ multiple_line_docblock_name {
855855
# Check if current line indentation does match the previous line docblock item.
856856
if ($0 ~ multiple_line_identation_regex ) {
857857
debug("→ @" multiple_line_docblock_name " - new line")
858-
858+
859859
# Current line has the same indentation as the stderr section.
860-
860+
861861
# Remove indentation and trailing spaces.
862862
sub(/^[[:space:]]*#[[:space:]]+/, "")
863863
sub(/[[:space:]]+$/, "")
@@ -968,18 +968,18 @@ END {
968968
print render("h1", file_title)
969969

970970
if (file_brief != "") {
971-
print file_brief "\n"
971+
print file_brief "\n"
972972
}
973973

974974
if (file_description != "") {
975975
print render("h2", "Overview")
976-
print file_description "\n"
976+
print file_description "\n"
977977
}
978978
}
979979

980980
if (toc != "") {
981981
print render("h2", "Index")
982-
print toc "\n"
982+
print toc "\n"
983983
}
984984

985985
print doc

tests/teardown.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

tests/testcases/@deprecated-standalone.test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
tests:put input <<EOF
3+
tests:put input << EOF
44
# @name Project Name
55
# @brief Brief
66
# @description overview
@@ -11,7 +11,7 @@ some:first:func() {
1111
}
1212
EOF
1313

14-
tests:put expected <<EOF
14+
tests:put expected << EOF
1515
# Project Name
1616
1717
Brief

tests/testcases/@deprecated.test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
tests:put input <<EOF
3+
tests:put input << EOF
44
# @name Project Name
55
# @brief Brief
66
# @description overview
@@ -12,7 +12,7 @@ some:first:func() {
1212
}
1313
EOF
1414

15-
tests:put expected <<EOF
15+
tests:put expected << EOF
1616
# Project Name
1717
1818
Brief

tests/testcases/@function-declaration.test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
tests:put input <<EOF
3+
tests:put input << EOF
44
# @name Project Name
55
# @brief Brief
66
# @description the file description
@@ -45,7 +45,7 @@ g
4545
h
4646
EOF
4747

48-
tests:put expected <<EOF
48+
tests:put expected << EOF
4949
# Project Name
5050
5151
Brief

tests/testcases/@name-and-@description.test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/usr/bin/env bash
22

3-
tests:put input <<EOF
3+
tests:put input << EOF
44
# @name Project Name
55
# @brief Brief
66
# @description a
@@ -27,7 +27,7 @@ c() {
2727
}
2828
EOF
2929

30-
tests:put expected <<EOF
30+
tests:put expected << EOF
3131
# Project Name
3232
3333
Brief

tests/testcases/@option.test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# - appears before numeric argument list.
1616
# - appears between @example and @set sections.
1717

18-
tests:put input <<EOF
18+
tests:put input << EOF
1919
# @name shdoc @option tests for options
2020
# @brief Test @option functionnality for options.
2121
# @description Tests for shdoc processing of @option keyword.
@@ -41,7 +41,7 @@ test-arg() {
4141
}
4242
EOF
4343

44-
tests:put expected <<EOF
44+
tests:put expected << EOF
4545
# shdoc @option tests for options
4646
4747
Test @option functionnality for options.

tests/testcases/@section.test.sh

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
tests:put input <<EOF
1+
tests:put input << EOF
32
# @name Project Name
43
# @brief Brief
54
# @description a
@@ -25,7 +24,7 @@ b() {
2524
}
2625
EOF
2726

28-
tests:put expected <<EOF
27+
tests:put expected << EOF
2928
# Project Name
3029
3130
Brief

tests/testcases/@see.test.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# - a markdown link.
2020
# - a text containing a markdown link.
2121
# - a text containing a markdown link and a URL.
22-
tests:put input <<EOF
22+
tests:put input << EOF
2323
# @name shdoc @see tests
2424
# @brief Test @see functionnality.
2525
# @description Tests for shdoc processing of @see keyword.
@@ -45,7 +45,7 @@ test-working-see() {
4545
4646
EOF
4747

48-
tests:put expected <<EOF
48+
tests:put expected << EOF
4949
# shdoc @see tests
5050
5151
Test @see functionnality.

0 commit comments

Comments
 (0)