Improved CLI help, updated URLs in read-me
This commit is contained in:
parent
2ab070c353
commit
fae24e926a
|
@ -28,6 +28,5 @@
|
||||||
{"name": "Tom Mortimer-Jones", "email": "tom@morty.co.uk"}
|
{"name": "Tom Mortimer-Jones", "email": "tom@morty.co.uk"}
|
||||||
{"name": "Michael Klement", "email": "mklement0@gmail.com"}
|
{"name": "Michael Klement", "email": "mklement0@gmail.com"}
|
||||||
],
|
],
|
||||||
"license": "BSD",
|
"license": "BSD"
|
||||||
"readmeFilename": "readme.md"
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,14 +12,14 @@ other Unix platforms.
|
||||||
Urchin's tests are written in Urchin, so you can run them to see what Urchin
|
Urchin's tests are written in Urchin, so you can run them to see what Urchin
|
||||||
is like. Clone the repository
|
is like. Clone the repository
|
||||||
|
|
||||||
git clone git://github.com/scraperwiki/urchin.git
|
git clone git://github.com/tlevine/urchin.git
|
||||||
|
|
||||||
Run the tests
|
Run the tests
|
||||||
|
|
||||||
cd urchin
|
cd urchin
|
||||||
./urchin tests
|
./urchin tests
|
||||||
|
|
||||||
The above command will run the tests in your systems default
|
The above command will run the tests in your system's default
|
||||||
shell, /bin/sh (on recent Ubuntu this is dash, but it could be
|
shell, /bin/sh (on recent Ubuntu this is dash, but it could be
|
||||||
ksh or bash on other systems); to test urchin's cross-shell compatibility,
|
ksh or bash on other systems); to test urchin's cross-shell compatibility,
|
||||||
run this:
|
run this:
|
||||||
|
@ -31,7 +31,7 @@ run this:
|
||||||
Download Urchin like so (as root) (or use npm, below):
|
Download Urchin like so (as root) (or use npm, below):
|
||||||
|
|
||||||
cd /usr/local/bin
|
cd /usr/local/bin
|
||||||
wget https://raw.github.com/scraperwiki/urchin/master/urchin
|
wget https://raw.github.com/tlevine/urchin/master/urchin
|
||||||
chmod +x urchin
|
chmod +x urchin
|
||||||
|
|
||||||
Can be installed with npm too:
|
Can be installed with npm too:
|
||||||
|
@ -154,4 +154,4 @@ It might make sense if you do this.
|
||||||
|
|
||||||
## Alternatives to Urchin
|
## Alternatives to Urchin
|
||||||
Alternatives to Urchin are discussed in
|
Alternatives to Urchin are discussed in
|
||||||
[this blog post](https://blog.scraperwiki.com/2012/12/how-to-test-shell-scripts/).
|
[this blog post](https://blog.tlevine.com/2012/12/how-to-test-shell-scripts/).
|
||||||
|
|
31
urchin
31
urchin
|
@ -95,19 +95,22 @@ has_sh_or_no_shebang_line() {
|
||||||
USAGE="usage: $0 [<options>] <test directory>"
|
USAGE="usage: $0 [<options>] <test directory>"
|
||||||
|
|
||||||
urchin_help() {
|
urchin_help() {
|
||||||
echo
|
cat <<EOF
|
||||||
echo "$USAGE"
|
|
||||||
echo
|
$USAGE
|
||||||
echo '-s <shell> Invoke test scripts that either have no shebang line or'
|
|
||||||
echo ' shebang line "#!/bin/sh" with the specified shell.'
|
-s <shell> Invoke test scripts that either have no shebang line at all or
|
||||||
echo '-f Force running even if the test directory'\''s name does not'
|
have shebang line "#!/bin/sh" with the specified shell.
|
||||||
echo ' contain the word "test".'
|
-f Force running even if the test directory's name does not
|
||||||
echo '-x Run "$TEST_SHELL", falling back on /bin/sh. This might be'
|
contain the word "test".
|
||||||
echo ' useful in the shebang line (experimental).'
|
-x [Experimental; not meant for direct invocation, but for use in
|
||||||
echo '-h This help.'
|
the shebang line of test scripts]
|
||||||
echo
|
Run with "\$TEST_SHELL", falling back on /bin/sh.
|
||||||
echo 'Go to https://github.com/tlevine/urchin for documentation on writing tests.'
|
-h This help.
|
||||||
echo
|
|
||||||
|
Go to https://github.com/tlevine/urchin for documentation on writing tests.
|
||||||
|
|
||||||
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
plural () {
|
plural () {
|
||||||
|
@ -175,7 +178,7 @@ do
|
||||||
shell_for_sh_tests=$1
|
shell_for_sh_tests=$1
|
||||||
which "$shell_for_sh_tests" >/dev/null || { echo "Cannot find specified shell: '$shell_for_sh_tests'" >&2; urchin_help >&2; exit 2; }
|
which "$shell_for_sh_tests" >/dev/null || { echo "Cannot find specified shell: '$shell_for_sh_tests'" >&2; urchin_help >&2; exit 2; }
|
||||||
;;
|
;;
|
||||||
-x) # `urchin -sh` is equivalent to "$TEST_SHELL"
|
-x) # `urchin -x <test-script>` is equivalent to `"$TEST_SHELL" <test-script>`
|
||||||
shift
|
shift
|
||||||
urchinsh=${TEST_SHELL:-/bin/sh}
|
urchinsh=${TEST_SHELL:-/bin/sh}
|
||||||
"$urchinsh" "$@"
|
"$urchinsh" "$@"
|
||||||
|
|
Loading…
Reference in New Issue