From 437be558a893ac70c030794df99a866e8ed01879 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Thu, 27 Nov 2025 12:05:49 -0500 Subject: Add `recursive` arg to Path.create_directory() --- api/api.md | 4 +++- api/paths.md | 4 +++- api/paths.yaml | 7 +++++++ 3 files changed, 13 insertions(+), 2 deletions(-) (limited to 'api') diff --git a/api/api.md b/api/api.md index 5c9dc9c4..ec6ffb49 100644 --- a/api/api.md +++ b/api/api.md @@ -2777,15 +2777,17 @@ assert (./directory).children(include_hidden=yes) == [".git", "foo.txt"] ## Path.create_directory ```tomo -Path.create_directory : func(path: Path, permissions = Int32(0o755) -> Void) +Path.create_directory : func(path: Path, permissions = Int32(0o755), recursive = yes -> Void) ``` Creates a new directory at the specified path with the given permissions. If any of the parent directories do not exist, they will be created as needed. + Argument | Type | Description | Default ---------|------|-------------|--------- path | `Path` | The path of the directory to create. | - permissions | `` | The permissions to set on the new directory. | `Int32(0o755)` +recursive | `` | If set to `yes`, then recursively create any parent directories if they don't exist, otherwise fail if the parent directory does not exist. When set to `yes`, this function behaves like `mkdir -p`. | `yes` **Return:** Nothing. diff --git a/api/paths.md b/api/paths.md index 07f0560b..4beabdc2 100644 --- a/api/paths.md +++ b/api/paths.md @@ -253,15 +253,17 @@ assert (./directory).children(include_hidden=yes) == [".git", "foo.txt"] ## Path.create_directory ```tomo -Path.create_directory : func(path: Path, permissions = Int32(0o755) -> Void) +Path.create_directory : func(path: Path, permissions = Int32(0o755), recursive = yes -> Void) ``` Creates a new directory at the specified path with the given permissions. If any of the parent directories do not exist, they will be created as needed. + Argument | Type | Description | Default ---------|------|-------------|--------- path | `Path` | The path of the directory to create. | - permissions | `` | The permissions to set on the new directory. | `Int32(0o755)` +recursive | `` | If set to `yes`, then recursively create any parent directories if they don't exist, otherwise fail if the parent directory does not exist. When set to `yes`, this function behaves like `mkdir -p`. | `yes` **Return:** Nothing. diff --git a/api/paths.yaml b/api/paths.yaml index 8fbd18dc..65d63671 100644 --- a/api/paths.yaml +++ b/api/paths.yaml @@ -258,6 +258,7 @@ Path.create_directory: description: > Creates a new directory at the specified path with the given permissions. If any of the parent directories do not exist, they will be created as needed. + note: > return: type: 'Void' description: > @@ -271,6 +272,12 @@ Path.create_directory: default: 'Int32(0o755)' description: > The permissions to set on the new directory. + recursive: + default: 'yes' + description: > + If set to `yes`, then recursively create any parent directories if they + don't exist, otherwise fail if the parent directory does not exist. When + set to `yes`, this function behaves like `mkdir -p`. example: | (./new_directory).create_directory() -- cgit v1.2.3