From 0bc86dc5e6ee844da51da3c866596c1c088513a4 Mon Sep 17 00:00:00 2001 From: Ralph Minderhoud Date: Thu, 19 Nov 2020 14:44:27 -0600 Subject: [PATCH 1/2] Add docs for justfile and justfile_directory functions --- README.adoc | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/README.adoc b/README.adoc index b6a7a5b242..5c8996c4db 100644 --- a/README.adoc +++ b/README.adoc @@ -506,6 +506,19 @@ build: cd {{invocation_directory()}}; ./some_script_that_needs_to_be_run_from_here ``` +==== Justfile and Justfile Directory + +- `justfile()` - Retrieves the path to the current justfile + +- `justfile_directory()` - Retrieves the path to the parent directory of the current justfile + +For example, if you need to run a command relative to the current justfile, you could do the following: + +``` +script: + ./{{justfile_directory()}}/scripts/some_script +``` + ==== Dotenv Integration `just` will load environment variables from a file named `.env`. This file can be located in the same directory as your justfile or in a parent directory. These variables are environment variables, not `just` variables, and so must be accessed using `$VARIABLE_NAME` in recipes and backticks. From 202080c2382ca43e9f9da71abbec7c6876d611ad Mon Sep 17 00:00:00 2001 From: Ralph Minderhoud Date: Thu, 19 Nov 2020 17:00:01 -0600 Subject: [PATCH 2/2] Update justfile()/justfile_directory() doc wording --- README.adoc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.adoc b/README.adoc index 5c8996c4db..7e4a0f3c32 100644 --- a/README.adoc +++ b/README.adoc @@ -508,11 +508,11 @@ build: ==== Justfile and Justfile Directory -- `justfile()` - Retrieves the path to the current justfile +- `justfile()` - Retrieves the path of the current justfile. -- `justfile_directory()` - Retrieves the path to the parent directory of the current justfile +- `justfile_directory()` - Retrieves the path of the parent directory of the current justfile. -For example, if you need to run a command relative to the current justfile, you could do the following: +For example, to run a command relative to the location of the current justfile: ``` script: