From d4abc27b3aad15a402e938d69a328d785d1a1259 Mon Sep 17 00:00:00 2001 From: Aaron Niskin Date: Thu, 21 Jan 2021 12:52:34 -0600 Subject: [PATCH 1/2] allow jekyll serve parameters in contrib/func.sh Changed port and path to environment variables with the same defaults, and pass any commandline args directly to jekyll serve. This is useful in particular when working with drafts (one can now run `github-pages --drafts` and it works as expected). --- contrib/func.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/contrib/func.sh b/contrib/func.sh index 47be7ad4..0fa2fe47 100644 --- a/contrib/func.sh +++ b/contrib/func.sh @@ -1,13 +1,11 @@ #!/usr/bin/env sh -# The github-pages function optionally takes two arguments -# - the first argument is the path to the Jekyll site -# - the second argument is the port number + function github-pages { - _path=${1:-.} - _port=${2:-4000} + _path=${GH_PATH:-.} + _port=${GH_PORT:-4000} docker run --rm \ -p $_port:4000 \ -u `id -u`:`id -g` \ -v `realpath $_path`:/src/site \ - gh-pages + gh-pages jekyll serve -H 0.0.0.0 -P 4000 $@ } From 5e379e6e035a53454e165b927f0a0221fa1d3b9e Mon Sep 17 00:00:00 2001 From: Aaron Niskin Date: Thu, 21 Jan 2021 13:08:40 -0600 Subject: [PATCH 2/2] added documentation back to contrib/func.sh --- contrib/func.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/func.sh b/contrib/func.sh index 0fa2fe47..6d840138 100644 --- a/contrib/func.sh +++ b/contrib/func.sh @@ -1,4 +1,7 @@ #!/usr/bin/env sh +# The github-pages function optionally reads two environment variables +# - the first is the path to the Jekyll site (GH_PATH) +# - the second is the port number (GH_PORT) function github-pages { _path=${GH_PATH:-.}