Skip to content

Convert file and directory hierarchy to a JSON object

License

Notifications You must be signed in to change notification settings

lukassup/json-dirtree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://travis-ci.org/lukassup/json-dirtree.svg?branch=master

json-dirtree

json-dirtree converts file and directory hierarchy to a JSON object

Example

$ 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"
    }
}

Installation

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

Usage

$ 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

Development

Install the json-dirtree package in editable mode using pip:

$ git clone https://github.com/lukassup/json-dirtree.git
$ pip install -e ./json-dirtree

Testing

Run the tests:

$ git clone https://github.com/lukassup/json-dirtree.git
$ cd json-dirtree
$ python2 setup.py test
$ python3 setup.py test

About

Convert file and directory hierarchy to a JSON object

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages