Improve dirname and basename filter doc (#80054)

pull/80319/head
Daniel Ziegenberg 1 year ago committed by GitHub
parent 93d0253292
commit 93beef053e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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:

@ -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:

Loading…
Cancel
Save