Skip to content

Commit

Permalink
Merge pull request #53 from kdheepak/docker-github-actions
Browse files Browse the repository at this point in the history
Update panvimdoc.sh to work on github actions with docker and scripts-dir
  • Loading branch information
kdheepak committed Sep 17, 2023
2 parents 18860d9 + e6dc85c commit 7a127ab
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion doc/panvimdoc.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
*panvimdoc.txt* For NVIM v0.8.0 Last change: 2023 September 13
*panvimdoc.txt* For NVIM v0.8.0 Last change: 2023 September 17

==============================================================================
Table of Contents *panvimdoc-table-of-contents*
Expand Down
17 changes: 13 additions & 4 deletions panvimdoc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Arguments:
--doc-mapping-project-name: 'true' if tags generated for mapping docs contain project name, 'false' otherwise
--shift-heading-level-by: 0 if you don't want to shift heading levels , n otherwise
--increment-heading-level-by: 0 if don't want to increment the starting heading number, n otherwise
--scripts-dir: '/scripts' if `GITHUB_ACTIONS`=`true` or `.dockerenv` is present, `$0/scripts` if no argument is passed, scripts directory otherwise
EOF
exit 0
}
Expand Down Expand Up @@ -95,6 +96,11 @@ while [[ $# -gt 0 ]]; do
shift # past argument
shift # past value
;;
--scripts-dir)
SCRIPTS_DIR="$2"
shift # past argument
shift # past value
;;
--help | -h)
usage
;;
Expand All @@ -105,11 +111,14 @@ while [[ $# -gt 0 ]]; do
esac
done

# Check if /scripts directory exists
if [ -d "scripts" ]; then
SCRIPTS_DIR="scripts"
echo "SCRIPTS"
# If the user provided a scripts directory, use that. Otherwise, determine environment.
if [[ "${GITHUB_ACTIONS:-false}" == "true" || -f /.dockerenv ]]; then
# GitHub Actions or Docker
SCRIPTS_DIR="/scripts"
elif [[ -n "${SCRIPTS_DIR:-}" ]]; then
SCRIPTS_DIR="$SCRIPTS_DIR"
else
# Use the scripts directory alongside the script's location
SCRIPTS_DIR="$(dirname "$(readlink -f "$0")")/scripts"
fi

Expand Down

0 comments on commit 7a127ab

Please sign in to comment.