From ea21d19353371dd413f2cd00d09f39e78b539694 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Thu, 1 Aug 2024 14:19:43 -0400 Subject: [PATCH 1/4] add working-directory docs --- README.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index bdab4b75a4..d2cc6c5fd8 100644 --- a/README.md +++ b/README.md @@ -750,12 +750,15 @@ $ just --list --list-heading '' ### Working Directory By default, recipes run with the working directory set to the directory that -contains the `justfile`. +contains the `justfile`. You can override working directory for all recipes +with `set working-directory := '...'`. The value is relative to the location +of the justfile. The `[no-cd]` attribute can be used to make recipes run with the working directory set to directory in which `just` was invoked. ```just +set working-directory := 'mydir' @foo: pwd @@ -767,7 +770,7 @@ directory set to directory in which `just` was invoked. ```sh $ cd subdir $ just foo -/ +/mydir : just bar /subdir ``` From ef0278ade54176ef6fda273d8aeb65af923fc6ee Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Fri, 2 Aug 2024 09:52:24 -0400 Subject: [PATCH 2/4] Update README.md --- README.md | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index d2cc6c5fd8..0e110cc5c1 100644 --- a/README.md +++ b/README.md @@ -758,7 +758,6 @@ The `[no-cd]` attribute can be used to make recipes run with the working directory set to directory in which `just` was invoked. ```just -set working-directory := 'mydir' @foo: pwd @@ -770,11 +769,25 @@ set working-directory := 'mydir' ```sh $ cd subdir $ just foo -/mydir +/ : just bar /subdir ``` +#### Using working-directory setting +```just +set working-directory := 'subdir' +@foo: + pwd +``` + +```sh +$ pwd +/ +$ just foo +/subdir +``` + ### Aliases Aliases allow recipes to be invoked on the command line with alternative names: From 399ea2cd39b5654363bf3bff141a9b50312906bc Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Fri, 2 Aug 2024 12:48:31 -0700 Subject: [PATCH 3/4] Adapt --- README.md | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0e110cc5c1..858e16ea5f 100644 --- a/README.md +++ b/README.md @@ -750,9 +750,7 @@ $ just --list --list-heading '' ### Working Directory By default, recipes run with the working directory set to the directory that -contains the `justfile`. You can override working directory for all recipes -with `set working-directory := '...'`. The value is relative to the location -of the justfile. +contains the `justfile`. The `[no-cd]` attribute can be used to make recipes run with the working directory set to directory in which `just` was invoked. @@ -774,9 +772,12 @@ $ just foo /subdir ``` -#### Using working-directory setting +You can override working directory with `set working-directory := '…'`, whose value +is relative to the default working directory. + ```just -set working-directory := 'subdir' +set working-directory := 'bar' + @foo: pwd ``` @@ -785,7 +786,7 @@ set working-directory := 'subdir' $ pwd / $ just foo -/subdir +/bar ``` ### Aliases From 28938bbb15704277355bab8f984e561032f668b9 Mon Sep 17 00:00:00 2001 From: Casey Rodarmor Date: Fri, 2 Aug 2024 12:49:06 -0700 Subject: [PATCH 4/4] Enhance --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 858e16ea5f..e6db4f2828 100644 --- a/README.md +++ b/README.md @@ -784,9 +784,9 @@ set working-directory := 'bar' ```sh $ pwd -/ +/home/bob $ just foo -/bar +/home/bob/bar ``` ### Aliases