Skip to content

Commit

Permalink
Merge pull request #45 from yanagiragi/master
Browse files Browse the repository at this point in the history
Supports OSX and fix example test
  • Loading branch information
kovetskiy authored Jun 17, 2022
2 parents 6e362b7 + c209836 commit 05b3ab5
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 42 deletions.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@ include vendor/github.com/reconquest/test-runner.bash/Makefile

DST = /usr/local/bin/
install:
cp shdoc $(DST)
case $$OSTYPE in \
darwin*) sed 's/\/usr\/bin\/gawk/\/usr\/bin\/env gawk/' shdoc > $(DST)/shdoc;; \
*) cp shdoc $(DST);; \
esac
chmod +x $(DST)shdoc
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ The project solves lots of problems:

## Index

* [say-hello()](#say-hello)
* [say-hello](#say-hello)

### say-hello()
### say-hello

My super function.
Not thread-safe.
Expand Down
6 changes: 3 additions & 3 deletions shdoc
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,7 @@ in_example {
next
}

/^[ \t]*(function([ \t])+)?([a-zA-Z0-9_:-\\.]+)([ \t]*)(\(([ \t]*)\))?[ \t]*\{/ \
/^[ \t]*(function([ \t])+)?([a-zA-Z0-9_\-:-\\.]+)([ \t]*)(\(([ \t]*)\))?[ \t]*\{/ \
&& (length(docblock) != 0 || description != "") && !in_example {
debug("→ function")
if (is_internal) {
Expand All @@ -440,8 +440,8 @@ in_example {

is_internal = 0
func_name = gensub(\
/^[ \t]*(function([ \t])+)?([a-zA-Z0-9_:-\\.]+)[ \t]*\(.*/, \
"\\3()", \
/^[ \t]*(function([ \t])+)?([a-zA-Z0-9_\-:-\\.]+)[ \t]*\(.*/, \
"\\3", \
"g" \
)

Expand Down
12 changes: 6 additions & 6 deletions tests/testcases/@[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ c
## Index
* [a()](#a)
* [b()](#b)
* [c()](#c)
* [a](#a)
* [b](#b)
* [c](#c)
### a()
### a
func a
line a 2
_Function has no arguments._
### b()
### b
func b
ab
_Function has no arguments._
### c()
### c
func c
Expand Down
4 changes: 2 additions & 2 deletions tests/testcases/@set.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ a
## Index
* [b()](#b)
* [b](#b)
### b()
### b
func b
Expand Down
4 changes: 2 additions & 2 deletions tests/testcases/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ EOF
tests:put expected <<EOF
## Index
* [tests:value()](#testsvalue)
* [tests:value](#testsvalue)
### tests:value()
### tests:value
Same, as \`tests:eval\`, but writes stdout into given variable and
return stderr as expected.
Expand Down
4 changes: 2 additions & 2 deletions tests/testcases/function-tags.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ EOF
tests:put expected <<EOF
## Index
* [some:first:func()](#somefirstfunc)
* [some:first:func](#somefirstfunc)
### some:first:func()
### some:first:func
Multiline description goes here and
there
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ EOF
tests:put expected <<EOF
## Index
* [fn1()](#fn1)
* [fn2()](#fn2)
* [fn1](#fn1)
* [fn2](#fn2)
### fn1()
### fn1
a desc for fn1
### fn2()
### fn2
a desc for fn2
EOF
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ EOF
tests:put expected <<EOF
## Index
* [fn1()](#fn1)
* [fn2()](#fn2)
* [fn1](#fn1)
* [fn2](#fn2)
### fn1()
### fn1
a desc for fn1
#### See also
* [fn2()](#fn2)
### fn2()
### fn2
a desc for fn2
EOF
Expand Down
24 changes: 12 additions & 12 deletions tests/testcases/issue-4-whitespace-in-function-declaration.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ EOF
tests:put expected <<EOF
## Index
* [fn()](#fn)
* [spaces()](#spaces)
* [tab1()](#tab1)
* [tab2()](#tab2)
* [tab3()](#tab3)
* [tab4()](#tab4)
* [fn](#fn)
* [spaces](#spaces)
* [tab1](#tab1)
* [tab2](#tab2)
* [tab3](#tab3)
* [tab4](#tab4)
### fn()
### fn
#### Arguments
Expand All @@ -60,7 +60,7 @@ tests:put expected <<EOF
* result of fn
### spaces()
### spaces
#### Arguments
Expand All @@ -70,7 +70,7 @@ tests:put expected <<EOF
* result of spaces
### tab1()
### tab1
#### Arguments
Expand All @@ -80,7 +80,7 @@ tests:put expected <<EOF
* result of tab1
### tab2()
### tab2
#### Arguments
Expand All @@ -90,7 +90,7 @@ tests:put expected <<EOF
* result of tab2
### tab3()
### tab3
#### Arguments
Expand All @@ -100,7 +100,7 @@ tests:put expected <<EOF
* result of tab3
### tab4()
### tab4
#### Arguments
Expand Down
8 changes: 4 additions & 4 deletions tests/testcases/table-of-contents.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,16 @@ EOF
tests:put expected <<EOF
## Index
* [some:first:func()](#somefirstfunc)
* [some_other_func()](#some_other_func)
* [some:first:func](#somefirstfunc)
* [some_other_func](#some_other_func)
### some:first:func()
### some:first:func
example function 1
_Function has no arguments._
### some_other_func()
### some_other_func
function with underscores
Expand Down

0 comments on commit 05b3ab5

Please sign in to comment.