From 7aff35a37b5e8985bc154d10cda8b848eae70d96 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Fri, 13 Jan 2023 11:20:37 -0800 Subject: [PATCH] Document invocation_directory_native() (#1508) --- README.md | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 18bae44..1b469bc 100644 --- a/README.md +++ b/README.md @@ -1106,22 +1106,33 @@ $ just #### Invocation Directory -- `invocation_directory()` - Retrieves the absolute path to the current directory when `just` was invoked, before `just` changed it (chdir'd) prior to executing commands. +- `invocation_directory()` - Retrieves the absolute path to the current + directory when `just` was invoked, before `just` changed it (chdir'd) prior + to executing commands. On Windows, `invocation_directory()` uses `cygpath` to + convert the invocation directory to a Cygwin-compatible `/`-separated path. + Use `invocation_directory_native()` to return the verbatim invocation + directory on all platforms. -For example, to call `rustfmt` on files just under the "current directory" (from the user/invoker's perspective), use the following rule: +For example, to call `rustfmt` on files just under the "current directory" +(from the user/invoker's perspective), use the following rule: ```just rustfmt: find {{invocation_directory()}} -name \*.rs -exec rustfmt {} \; ``` -Alternatively, if your command needs to be run from the current directory, you could use (e.g.): +Alternatively, if your command needs to be run from the current directory, you +could use (e.g.): ```just build: cd {{invocation_directory()}}; ./some_script_that_needs_to_be_run_from_here ``` +- `invocation_directory_native()` - Retrieves the absolute path to the current + directory when `just` was invoked, before `just` changed it (chdir'd) prior + to executing commands. + #### Justfile and Justfile Directory - `justfile()` - Retrieves the path of the current `justfile`.