diff --git a/lib/ansible/plugins/filter/basename.yml b/lib/ansible/plugins/filter/basename.yml index 4e868df8047..b6e31d232d3 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 52f7d5d42e3..4b8b0f7b29d 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: