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](https://github.com/CodyHouse/multi-level-accordion-menu) HTML/CSS codebase for displaying files and directories neatly.

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

![screenshot](tree-html-screenshot.png)

## 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.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

tree_html-1.1.2-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file tree_html-1.1.2-py3-none-any.whl.

File metadata

  • Download URL: tree_html-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.7.1

File hashes

Hashes for tree_html-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d3fc7d540b7ad19a5d9b8ed3e811ea5b770aafd1cb0eee39ac0ecb87c37c4adc
MD5 97c65c9541da871a543a8482ab31def1
BLAKE2b-256 864543b8339886cfaf26925b5acf3b63dc81eb8f5bc6781bea4b15e8dc1a08a6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page