mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-02-16 02:53:44 +00:00
fix(scripts): correct usage and help exit status (#143)
This commit is contained in:
@@ -97,7 +97,7 @@ Examples:
|
|||||||
# Use GitHub Enterprise API
|
# Use GitHub Enterprise API
|
||||||
GITHUB_API_URL="https://github.example.com/api/v3/repos" $BIN ivuorinen/dotfiles
|
GITHUB_API_URL="https://github.example.com/api/v3/repos" $BIN ivuorinen/dotfiles
|
||||||
EOF
|
EOF
|
||||||
exit 1
|
exit 0
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check that required dependencies are installed
|
# Check that required dependencies are installed
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
#
|
#
|
||||||
# Create a directory and cd into it
|
# Create a directory and cd into it
|
||||||
# Usage: mkcd <dir>
|
# Usage: x-mkd <dir>
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
@test "x-gh-get-latest-version help" {
|
@test "x-gh-get-latest-version help" {
|
||||||
run bash local/bin/x-gh-get-latest-version --help
|
run bash local/bin/x-gh-get-latest-version --help
|
||||||
[ "$status" -eq 1 ]
|
[ "$status" -eq 0 ]
|
||||||
[[ "$output" == "Usage: x-gh-get-latest-version"* ]]
|
[[ "$output" == "Usage: x-gh-get-latest-version"* ]]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,3 +5,9 @@
|
|||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[[ "$output" == "x-localip version"* ]]
|
[[ "$output" == "x-localip version"* ]]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "x-localip help" {
|
||||||
|
run bash local/bin/x-localip --help
|
||||||
|
[ "$status" -eq 0 ]
|
||||||
|
[[ "$output" == "Usage:"* ]]
|
||||||
|
}
|
||||||
|
|||||||
@@ -6,3 +6,9 @@
|
|||||||
[ "$status" -eq 0 ]
|
[ "$status" -eq 0 ]
|
||||||
[ -d "$dir" ]
|
[ -d "$dir" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "x-mkd with no args shows usage" {
|
||||||
|
run bash local/bin/x-mkd
|
||||||
|
[ "$status" -eq 1 ]
|
||||||
|
[[ "$output" == "Usage:"* ]]
|
||||||
|
}
|
||||||
|
|||||||
@@ -20,3 +20,9 @@
|
|||||||
VERBOSE=1 source local/bin/x-path-remove "$BATS_TMPDIR/dir"
|
VERBOSE=1 source local/bin/x-path-remove "$BATS_TMPDIR/dir"
|
||||||
[ "$PATH" = "/usr/bin" ]
|
[ "$PATH" = "/usr/bin" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "x-path-append skips missing directory" {
|
||||||
|
PATH="/usr/bin"
|
||||||
|
VERBOSE=1 source local/bin/x-path-append "$BATS_TMPDIR/no-such"
|
||||||
|
[ "$PATH" = "/usr/bin" ]
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user