aboutsummaryrefslogtreecommitdiff
path: root/api/paths.yaml
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-06-24 13:37:09 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-06-24 13:37:09 -0400
commit271017ba9970e4220e1bd0dc83ce146afe9222a2 (patch)
tree995233d21141f164aa5f9e1d9b7bab757124e622 /api/paths.yaml
parente122e5525ef044c25c2cd888bc267f7a2bd91b4f (diff)
Add Path.has_extension() and update manpages/api docs
Diffstat (limited to 'api/paths.yaml')
-rw-r--r--api/paths.yaml28
1 files changed, 28 insertions, 0 deletions
diff --git a/api/paths.yaml b/api/paths.yaml
index 40813129..1bfe5d6d 100644
--- a/api/paths.yaml
+++ b/api/paths.yaml
@@ -463,6 +463,34 @@ Path.group:
= "root"
>> (/non/existent/file).group()
= none
+
+Path.has_extension:
+ short: check if a path has a given extension
+ description: >
+ Return whether or not a path has a given file extension.
+ return:
+ type: 'Bool'
+ description: >
+ Whether or not the path has the given extension.
+ args:
+ path:
+ type: 'Path'
+ description: >
+ A path.
+ extension:
+ type: 'Text'
+ description: >
+ A file extension (leading `.` is optional). If empty, the check will
+ test if the file does not have any file extension.
+ example: |
+ >> (/foo.txt).has_extension("txt")
+ = yes
+ >> (/foo.txt).has_extension(".txt")
+ = yes
+ >> (/foo.tar.gz).has_extension("gz")
+ = yes
+ >> (/foo.tar.gz).has_extension("zip")
+ = no
Path.is_directory:
short: check if a path is a directory