[Home](https://kellyjonbrazil.github.io/jc/)
<a id="jc.parsers.path"></a>

# jc.parsers.path

jc - JSON Convert POSIX path string parser

Parse a POSIX path.

Usage (cli):

    $ echo "/Users/admin/.docker/bin" | jc --path

Usage (module):

    import jc
    result = jc.parse('path', path_string)

Schema:

    {
      "path":                      string,
      "parent":                    string,
      "filename":                  string,
      "stem":                      string,
      "extension":                 string,
      "path_list": [
                                   string
      ],
    }

Examples:

    $ echo "/abc/def/gh.txt" | jc --path -p
    {
      "path": "/abc/def/gh.txt",
      "parent": "/abc/def",
      "filename": "gh.txt",
      "stem": "gh",
      "extension": "txt",
      "path_list": [
        "/",
        "abc",
        "def",
        "gh.txt"
      ]
    }

<a id="jc.parsers.path.parse"></a>

### parse

```python
def parse(data, raw=False, quiet=False)
```

Main text parsing function

Parameters:

    data:        (string)  text data to parse
    raw:         (boolean) unprocessed output if True
    quiet:       (boolean) suppress warning messages if True

Returns:

    Dictionary representing a Key/Value pair document.

### Parser Information
Compatibility:  linux, darwin, cygwin, win32, aix, freebsd

Source: [`jc/parsers/path.py`](https://github.com/kellyjonbrazil/jc/blob/master/jc/parsers/path.py)

This parser can be used with the `--slurp` command-line option.

Version 1.0 by Michael Nietzold (https://github.com/muescha)
