json-dirtree
converts file and directory hierarchy to a JSON object
$ tree src
src
└── upper
└── lower
└── bottom
2 directories, 1 file
$ json-dirtree build
INFO:json_dirtree:building JSON tree for dirs: ['src/upper']
INFO:json_dirtree:writing JSON output to: './upper.json'
INFO:json_dirtree:done, 1 files written
$ cat upper.json
{
"lower": {
"bottom": "Hello"
}
}
Supported versions of Python are: 2.6, 2.7, 3.4, 3.5 and 3.6. The recommended way to install this package is via pip.
$ git clone https://github.com/lukassup/json-dirtree.git
$ pip install ./json-dirtree
For instructions on installing python and pip see "The Hitchhiker's Guide to Python" Installation Guides.
Alternatively use easy_install
:
$ git clone https://github.com/lukassup/json-dirtree.git
$ easy_install ./json-dirtree
$ json-dirtree build --help usage: json-dirtree build [-h] [-v | -q] [-o DIR] [dirs [dirs ...]] Builds JSON output from directory and file tree. positional arguments: dirs source directories (default: ./src/* ) optional arguments: -h, --help show this help message and exit -v, --verbose more verbose -q, --quiet less verbose -o DIR, --out-dir DIR output directory
Install the json-dirtree
package in editable mode using pip
:
$ git clone https://github.com/lukassup/json-dirtree.git
$ pip install -e ./json-dirtree
Run the tests:
$ git clone https://github.com/lukassup/json-dirtree.git
$ cd json-dirtree
$ python2 setup.py test
$ python3 setup.py test