From 73cd9781dfd86a419332117cd7e38ff88cdda6d9 Mon Sep 17 00:00:00 2001
From: jurgenhaas <juergen@paragon-es.de>
Date: Sun, 20 Feb 2022 11:52:27 +0100
Subject: [PATCH] Add host directory as env variable L3DHOSTDIR Add new command
 "dir" to show workdir

---
 run/scripts/dir   | 5 +++++
 run/scripts/help  | 2 +-
 run/scripts/start | 1 +
 3 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100755 run/scripts/dir

diff --git a/run/scripts/dir b/run/scripts/dir
new file mode 100755
index 0000000..801a8ff
--- /dev/null
+++ b/run/scripts/dir
@@ -0,0 +1,5 @@
+#!/bin/bash
+
+if [[ -n $1 ]]; then
+  docker inspect ${1}_l3d | jq -r .[0].Config.Env | grep L3DHOSTDIR | cut -d'=' -f 2 | cut -d'"' -f 1
+fi
diff --git a/run/scripts/help b/run/scripts/help
index 6670f4c..c2f266a 100755
--- a/run/scripts/help
+++ b/run/scripts/help
@@ -6,5 +6,5 @@ echo ""
 echo "Version: ${L3DVERSION}"
 echo "Support: https://gitlab.lakedrops.com/docker/l3d"
 echo ""
-echo "Usage:   l3d [ help | version | selfupdate [VERSION] | update | reset | PROJECTNAME | delete PROJECTNAME ] | list | info | . "
+echo "Usage:   l3d [ help | version | selfupdate [VERSION] | update | reset | PROJECTNAME | delete PROJECTNAME ] | list | info | dir | . "
 echo ""
diff --git a/run/scripts/start b/run/scripts/start
index 8256606..ccc8128 100755
--- a/run/scripts/start
+++ b/run/scripts/start
@@ -51,6 +51,7 @@ function startContainer() {
     fi
     if [[ "$mode" != "REGULAR" ]]; then
       start_params=(
+        --env L3DHOSTDIR=${WORKDIR}
         --env L3DVERSION=${L3DVERSION}
         --env L3DSHELL=${L3DSHELL}
         --env L3D_ALWAYS_CLEANUP=${L3D_ALWAYS_CLEANUP}
-- 
GitLab