Skip to main content

Renders an interactive directory structure in html from a local path on disk

Project description

# Tree HTML

Tree HTML renders an interactive directory structure in html from a local path on disk. It can be run as a standalone python tool or it can be fed JSON output produced by running tree separately somewhere else. This tool was built on top of the [CodyHouse]( HTML/CSS codebase for displaying files and directories neatly.

See the example output from running tree-html on this repo:


## General usage

In the most common case, tree-html can be run as a standalone tool on the current working directory as follows: ` tree-html `

A second use case involves supplying tree-html with the output json file obtained from running tree -J separately. This may be useful, for example, in cases where you are working on a different file system to the target path. This can be achieved by using the -i flag; for example: ` tree-html -i output-file-from-tree.json `

The default output from tree-html is a directory named tree-html/ which is generated in the current working directory. This directory contains a file called index.html, which can be opened in any browser for display. Note that this directory also contains some static assets that should always accompany the html file if the folder is to be moved or shared.

## Usage options

To execute the tool from a location other than the current working directory: ` tree-html /path/to/different/cool-location `

In the above case, it also might be desirable to specify a different top-level directory name to use in the output, rather than the full path. This can be achieved as follows: ` tree-html /path/to/different/cool-location -n cooler-location `

To limit the output to only contain a given depth below the top-level directory, the -l flag can be used: ` tree -l 3  # limits the output to three levels below the parent and ignores anything deeper `

Additional options may be supplied to customise the content and styling of the output file, such as using custom headings, text descriptions, different colored themes and url links. Run tree-html –help for the complete set of available options.

## Installation

Install using pip: ` pip install tree-html `

Or if you prefer to use pipenv to automatically install tree-html into a new isolated virtual environment: ` pipenv install . `

If you wish to develop this tool further then you should also install the development dependencies: ` pipenv install --dev `

If you would like to contribute, please either create a new branch or fork this repo and then submit a pull request. All contributions are welcome.

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for tree-html, version 1.1.2
Filename, size File type Python version Upload date Hashes
Filename, size tree_html-1.1.2-py3-none-any.whl (22.8 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page