Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
f69da544
Commit
f69da544
authored
Aug 05, 2015
by
Jon Hawkesworth
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add win_basename and win_dirname filters
parent
fad44862
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
0 deletions
+11
-0
docsite/rst/playbooks_filters.rst
+8
-0
lib/ansible/plugins/filter/core.py
+3
-0
No files found.
docsite/rst/playbooks_filters.rst
View file @
f69da544
...
...
@@ -338,10 +338,18 @@ To get the last name of a file path, like 'foo.txt' out of '/etc/asdf/foo.txt'::
{{ path | basename }}
To get the last name of a windows style file path (new in version 2.0)::
{{ path | win_basename }}
To get the directory from a path::
{{ path | dirname }}
To get the directory from a windows path (new version 2.0)::
{{ path | win_dirname }}
To expand a path containing a tilde (`~`) character (new in version 1.5)::
{{ path | expanduser }}
...
...
lib/ansible/plugins/filter/core.py
View file @
f69da544
...
...
@@ -21,6 +21,7 @@ import sys
import
base64
import
json
import
os.path
import
ntpath
import
types
import
pipes
import
glob
...
...
@@ -251,6 +252,8 @@ class FilterModule(object):
'realpath'
:
partial
(
unicode_wrap
,
os
.
path
.
realpath
),
'relpath'
:
partial
(
unicode_wrap
,
os
.
path
.
relpath
),
'splitext'
:
partial
(
unicode_wrap
,
os
.
path
.
splitext
),
'win_basename'
:
partial
(
unicode_wrap
,
ntpath
.
basename
),
'win_dirname'
:
partial
(
unicode_wrap
,
ntpath
.
dirname
),
# value as boolean
'bool'
:
bool
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment