Skip to content

Commit 1b065d2

Browse files
committed
Make shell.sh invocable from the root directory
Currently, developers must switch to the scripts directory before invoking shell.sh, which is one extra command. Also, calling ./scripts/shell.sh fails due to the assumption that it is run in the scripts directory. This change makes shell.sh/bat robust against the invoking directory.
1 parent 0ab1ddb commit 1b065d2

3 files changed

Lines changed: 9 additions & 7 deletions

File tree

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ Illustrates:
3434
Run the shell script to start Embabel under Spring Shell:
3535

3636
```bash
37-
cd scripts
38-
./shell.sh
37+
./scripts/shell.sh
3938
```
4039

4140
There is a single example agent, `WriteAndReviewAgent`.

scripts/shell.cmd

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
@echo off
22
setlocal
33

4-
set AGENT_APPLICATION=..
4+
set "script_dir=%~dp0"
5+
set AGENT_APPLICATION=%script_dir%.."
56
set SPRING_PROFILES_ACTIVE=shell,severance
67

7-
call .\support\agent.bat
8+
call "%script_dir%support\agent.bat"
89

910
endlocal

scripts/shell.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
#!/usr/bin/env bash
22

3-
export AGENT_APPLICATION=..
3+
script_dir=$(dirname "$0")
4+
5+
export AGENT_APPLICATION="${script_dir}/.."
46

57
#export MAVEN_PROFILE=enable-mcp
68

7-
./support/check_env.sh || exit 1
9+
"$script_dir/support/check_env.sh" || exit 1
810

9-
cd ..
11+
cd "$AGENT_APPLICATION"
1012
mvn -Dmaven.test.skip=true spring-boot:run

0 commit comments

Comments
 (0)