mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #12024 from jhawkesworth/win_splitdrive_filter
Add win_splitdrive filter for windows users
This commit is contained in:
commit
d0350b1905
2 changed files with 13 additions and 0 deletions
|
@ -342,6 +342,18 @@ To get the last name of a windows style file path (new in version 2.0)::
|
|||
|
||||
{{ path | win_basename }}
|
||||
|
||||
To separate the windows drive letter from the rest of a file path (new in version 2.0)::
|
||||
|
||||
{{ path | win_splitdrive }}
|
||||
|
||||
To get only the windows drive letter
|
||||
|
||||
{{ path | win_splitdrive | first }}
|
||||
|
||||
To get the rest of the path without the drive letter
|
||||
|
||||
{{ path | win_splitdrive | last }}
|
||||
|
||||
To get the directory from a path::
|
||||
|
||||
{{ path | dirname }}
|
||||
|
|
|
@ -254,6 +254,7 @@ class FilterModule(object):
|
|||
'splitext': partial(unicode_wrap, os.path.splitext),
|
||||
'win_basename': partial(unicode_wrap, ntpath.basename),
|
||||
'win_dirname': partial(unicode_wrap, ntpath.dirname),
|
||||
'win_splitdrive': partial(unicode_wrap, ntpath.splitdrive),
|
||||
|
||||
# value as boolean
|
||||
'bool': bool,
|
||||
|
|
Loading…
Reference in a new issue