Skip to content
/ cmd-tree Public
forked from tdeh/py-tree

A command line tool for generating text-based representations of file hierarchies

License

Notifications You must be signed in to change notification settings

Borda/cmd-tree

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMD-Tree

This is continuation/fork of https://github.com/tdeh/py-tree

CI codecov

A command line tool for generating text-based representations of file hierarchies.

$ cmd-tree
.
|-- _config.yml
|-- LICENSE
|-- MANIFEST.in
|-- README.md
|-- setup.py
|-- fs_tree
|   |-- __init__.py
|   |-- __main__.py
|   |-- command_line.py
|   |-- directory_explorer.py
|   |-- directory_tree.py
|   `-- tree_printer.py
`-- tests
    |-- __init__.py
    |-- requirements.txt
    |-- test_directory_explorer.py
    |-- test_directory_tree.py
    `-- test_tree_printer.py

Install

Users

py-tree is registered on the Python Package Index and can be installed via pip:

pip install py-tree

Developers

Clone repository and run this pip command from the root project directory:

pip install -e .

Usage

Linux Terminal

Setuptools should create a standalone script for running Py-Tree and add it to your PATH. To run this script:

$ py-tree

To get argument details & descriptions:

$ py-tree -h

This should output something like:

usage: py-tree [-h] [-s] [-d [DEPTH_LIMIT]] [-o [OUTPUT_FILE]]
               [-w [INDENTATION_WIDTH]]
               [start]

Creates text-based graphical representations of directory hierarchies.

positional arguments:
  start                 Path to start the search

optional arguments:
  -h, --help            show this help message and exit
  -s, --show_hidden     Show hidden files/directories e.g. .file, ..dir
  -d [DEPTH_LIMIT], --depth_limit [DEPTH_LIMIT]
                        Maximum directory depth to be explored
  -o [OUTPUT_FILE], --output_file [OUTPUT_FILE]
                        Write output to file name specified
  -w [INDENTATION_WIDTH], --indentation_width [INDENTATION_WIDTH]
                        The indentation width in number of spaces per
                        directory level. Min width is 2, default is 4.

Python Console

To run from an interactive Python session:

from src import fs_tree

fs_tree.main()

To get argument details & descriptions:

help(fs_tree.main)

Running Unit Tests

For testing you need to install aditional testing dependencies from the requirements.txt file in the tests directory. Run this pip command from the root project directory:

pip install -r tests/requirements.txt

and then run the tests with:

pytest -v tests/

Linting

Install pylint:

pip install pylint

Run on code directory:

pylint src/

Contributing

See guidelines for contributions.

License

Apache License, Version 2.0

About

A command line tool for generating text-based representations of file hierarchies

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%