Skip to content

Commit 048fab0

Browse files
committed
.
1 parent c8a57d8 commit 048fab0

3 files changed

Lines changed: 38 additions & 3 deletions

File tree

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,14 @@ repos:
2828
hooks:
2929
- id: air-format
3030
name: air format
31-
entry: air format .
31+
entry: RcppTskit/tools/run-local-tool.sh air format .
3232
language: system
3333
pass_filenames: false
3434
files: '\.(R|Rmd|rmd|qmd|Qmd)$'
3535

3636
- id: jarl-lint
3737
name: jarl lint
38-
entry: jarl check .
38+
entry: RcppTskit/tools/run-local-tool.sh jarl check .
3939
language: system
4040
pass_filenames: false
4141
files: '\.(R|Rmd|rmd|qmd|Qmd)$'

RcppTskit/R/RcppTskit-package.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
#' @importFrom reticulate import is_py_object py_module_available py_require
2525
#'
2626
#' @examples
27-
#' vignette(package="RcppTskit_intro")
27+
#' vignette("RcppTskit_intro")
2828
"_PACKAGE"
2929

3030
#' Provide an inline plugin so we can call the tskit C API with functions like

RcppTskit/tools/run-local-tool.sh

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/usr/bin/env sh
2+
set -eu
3+
4+
if [ "$#" -lt 1 ]; then
5+
echo "Usage: $0 <tool> [args...]" >&2
6+
exit 2
7+
fi
8+
9+
tool="$1"
10+
shift
11+
12+
if command -v "$tool" >/dev/null 2>&1; then
13+
exec "$tool" "$@"
14+
fi
15+
16+
# Follow project guidance by checking user-local bin directories.
17+
if [ -n "${HOME:-}" ]; then
18+
PATH="${HOME}/.local/bin:${HOME}/bin:${PATH}"
19+
export PATH
20+
if command -v "$tool" >/dev/null 2>&1; then
21+
exec "$tool" "$@"
22+
fi
23+
fi
24+
25+
# As a last resort, query the user's login shell PATH.
26+
if [ -n "${SHELL:-}" ] && [ -x "${SHELL:-}" ]; then
27+
resolved="$("${SHELL}" -lc "command -v \"$tool\"" 2>/dev/null || true)"
28+
if [ -n "$resolved" ] && [ -x "$resolved" ]; then
29+
exec "$resolved" "$@"
30+
fi
31+
fi
32+
33+
echo "Executable '$tool' not found on PATH." >&2
34+
echo "Install '$tool' and ensure your shell PATH exports it." >&2
35+
exit 3

0 commit comments

Comments
 (0)