summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDaniel Ziegenberg <daniel@ziegenberg.at>2023-03-27 20:17:29 +0200
committerGitHub <noreply@github.com>2023-03-27 14:17:29 -0400
commit93beef053eabdb6ff2a9823bc8d0d1037671b1e3 (patch)
treebeb5c4d58ec45c19f8c54f2a42186ba7a6ba9ede /lib
parent93d0253292dc2e66432d96f047b66200a2d2e35b (diff)
downloadansible-93beef053eabdb6ff2a9823bc8d0d1037671b1e3.tar.gz
Improve dirname and basename filter doc (#80054)
Diffstat (limited to 'lib')
-rw-r--r--lib/ansible/plugins/filter/basename.yml4
-rw-r--r--lib/ansible/plugins/filter/dirname.yml4
2 files changed, 6 insertions, 2 deletions
diff --git a/lib/ansible/plugins/filter/basename.yml b/lib/ansible/plugins/filter/basename.yml
index 4e868df804..b6e31d232d 100644
--- a/lib/ansible/plugins/filter/basename.yml
+++ b/lib/ansible/plugins/filter/basename.yml
@@ -5,6 +5,8 @@ DOCUMENTATION:
short_description: get a path's base name
description:
- Returns the last name component of a path, what is left in the string that is not 'dirname'.
+ notes:
+ - The result of this filter is different from the Unix basename program; where basename for C(/foo/bar/) returns C(bar), the basename filter returns an empty string (C('')).
options:
_input:
description: A path.
@@ -15,7 +17,7 @@ DOCUMENTATION:
plugin: ansible.builtin.dirname
EXAMPLES: |
- # To get the last name of a file path, like 'foo.txt' out of '/etc/asdf/foo.txt'
+ # To get the last name of a file path, like 'foo.txt' out of '/etc/asdf/foo.txt'.
{{ mypath | basename }}
RETURN:
diff --git a/lib/ansible/plugins/filter/dirname.yml b/lib/ansible/plugins/filter/dirname.yml
index 52f7d5d42e..4b8b0f7b29 100644
--- a/lib/ansible/plugins/filter/dirname.yml
+++ b/lib/ansible/plugins/filter/dirname.yml
@@ -5,6 +5,8 @@ DOCUMENTATION:
short_description: get a path's directory name
description:
- Returns the 'head' component of a path, basically everything that is not the 'basename'.
+ notes:
+ - The result of this filter is different from the Unix dirname program; where dirname for C(/foo/bar/) returns C(/foo), the dirname filter returns the full path (C(/foo/bar/)).
options:
_input:
description: A path.
@@ -15,7 +17,7 @@ DOCUMENTATION:
plugin_type: filter
EXAMPLES: |
- # To get the dir name of a file path, like '/etc/asdf' out of '/etc/asdf/foo.txt'
+ # To get the dir name of a file path, like '/etc/asdf' out of '/etc/asdf/foo.txt'.
{{ mypath | dirname }}
RETURN: