summaryrefslogtreecommitdiffstats
path: root/lib/ansible/plugins/filter/relpath.yml
blob: 47611c7658616a3daa313354343b40618472f2b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
DOCUMENTATION:
  name: relpath
  author: Jakub Jirutka (@jirutka)
  version_added: "1.7"
  short_description: Make a path relative
  positional: _input, start
  description:
    - Converts the given path to a relative path from the I(start),
      or relative to the directory given in I(start).
  options:
    _input:
      description: A path.
      type: str
      required: true
    start:
      description: The directory the path should be relative to. If not supplied the current working directory will be used.
      type: str

EXAMPLES: |

  # foobar => ../test/me.txt
  testing: "{{ '/tmp/test/me.txt' | relpath('/tmp/other/') }}"
  otherrelpath: "{{ mypath | relpath(mydir) }}"

RETURN:
  _value:
    description: The relative path.
    type: str