Tree Plus
A simple command line interface (CLI) tool for developers to show a tree
enhanced with token counts, line counts, and source code components.
Example Output:
- Demonstrate Parsed Checkboxes
(py310) bion@WIN-QVRBL09D89C:~/hax/tree_plus$ tree_plus -i tests
π tree_plus (20023 tokens, 2071 lines)
β£ββ π .github
β βββ π workflows (503 tokens, 70 lines)
β β£ββ π microsoft.yml (263 tokens, 36 lines)
β β β£ββ Microsoft
β β β£ββ job: build
β β β£ββ - Set up Python ${{ matrix.python-version }}
β β β£ββ - Install tree_plus
β β β£ββ - Set PYTHONUTF8 for Windows
β β β£ββ - Run generic tests
β β βββ - Run specific test
β βββ π unix.yml (240 tokens, 34 lines)
β β£ββ Ubuntu & MacOS
β β£ββ job: build
β β£ββ - Set up Python ${{ matrix.python-version }}
β β£ββ - Install tree_plus
β β£ββ - Run generic tests
β βββ - Run specific test
β£ββ π tree_plus_src (8776 tokens, 1088 lines)
β β£ββ π __init__.py (64 tokens, 9 lines)
β β£ββ π count_tokens_lines.py (461 tokens, 67 lines)
β β β£ββ TODO (Line 11): show off how well we parse_todo!
β β β£ββ class TokenLineCount
β β β£ββ def count_tokens_lines
β β βββ def count_directory_tokens_lines
β β£ββ π traverse_directory.py (274 tokens, 39 lines)
β β βββ def traverse_directory
β β£ββ π default_ignore.py (248 tokens, 53 lines)
β βββ π parse_file.py (7729 tokens, 920 lines)
β β£ββ def parse_file
β β£ββ def is_k8s_yml
β β£ββ def is_ansible_yml
β β£ββ def is_github_yml
β β£ββ def parse_github_yml
β β£ββ def parse_k8s
β β£ββ def parse_ansible
β β£ββ def parse_yml
β β£ββ def extract_nodes
β β£ββ def is_typing_construct
β β£ββ def is_builtin_type
β β£ββ def parse_py
β β£ββ def parse_db
β β£ββ def parse_cobol
β β£ββ def parse_java
β β£ββ def parse_julia
β β£ββ def parse_kotlin
β β£ββ def parse_lisp
β β£ββ def parse_lua
β β£ββ def parse_objective_c
β β£ββ def parse_ocaml
β β£ββ def parse_apl
β β£ββ def parse_perl
β β£ββ def parse_php
β β£ββ def parse_powershell
β β£ββ def parse_matlab
β β£ββ def parse_scala
β β£ββ def parse_c
β β£ββ def parse_rs
β β£ββ def handle_block
β β£ββ def parse_tf
β β£ββ def parse_js
β β£ββ def parse_md
β β£ββ def parse_txt
β βββ def parse_todo
β£ββ π Makefile (85 tokens, 16 lines)
β£ββ π README.md (4530 tokens, 319 lines)
β β£ββ # Tree Plus
β β£ββ ## Example Output:
β β£ββ - [ ] Demonstrate Parsed Checkboxes
β β£ββ ## Start Quick!
β βββ ## Moar Usage
β£ββ π tree_plus_cli.py (2586 tokens, 298 lines)
β β£ββ def main
β β£ββ def tree_plus
β βββ def tree_to_string
β£ββ π setup.py (393 tokens, 69 lines)
β βββ TODO (Line 16): automatically install tree-sitter-{language} grammars
β£ββ π requirements.txt (11 tokens, 4 lines)
β£ββ π LICENSE (2123 tokens, 81 lines)
β£ββ π .gitignore (97 tokens, 28 lines)
βββ π sample_output.sh (3039 tokens, 184 lines)
- Demonstrate Parsed Checkboxes
Start Quick!
Prerequisites
Ensure you have the following tools installed:
Install Tree Plus
Local Hackable Install
- Clone the repository and cd into the tree_plus directory
gh repo clone https://github.com/bionicles/tree_plus.git && cd tree_plus
- Install tree_plus using Makefile
make cli
Alternatively, if make
is not installed, use pip
:
pip install -e .
Now, you can use the tree_plus
command.
- Add slick aliases like
tp
to your RC file Typical RC_FILE values~/.bash_profile
,~/.bashrc
, or~/.zshrc
RC_FILE=~/.bash_profile source alias_tree_plus.sh
RC_FILE=~/.bashrc source alias_tree_plus.sh
RC_FILE=~/.zshrc source alias_tree_plus.sh
Soon, you'll be able to simply run 'pip install tree_plus'. Stay tuned!
Usage
# Use tree_plus
tp
If you make changes to tree_plus
and need to reinstall it quickly, use the tpcli
alias:
# Reinstall tree_plus quickly after making changes
tpcli
Moar Usage
Multiple directories:
(py310) bion@WIN-QVRBL09D89C:~/hax/tree_plus$ tp tests/path_to_test,tests/more_languages/group1
Multiple Directories:
β£ββ π path_to_test (153 tokens, 38 lines)
β β£ββ π file.py (11 tokens, 2 lines)
β β βββ def hello_world
β β£ββ π file.txt (11 tokens, 2 lines)
β β£ββ π class_function_type.ts (45 tokens, 12 lines)
β β β£ββ type MyType
β β β£ββ class TsClass
β β βββ function tsFunction
β β£ββ π file.js (14 tokens, 3 lines)
β β βββ function helloWorld
β β£ββ π empty.py (0 tokens, 0 lines)
β β£ββ π file.md (12 tokens, 2 lines)
β β βββ # Hello, world!
β β£ββ π class_function.js (33 tokens, 9 lines)
β β β£ββ class MyClass
β β βββ function myFunction
β βββ π class_method_type.py (27 tokens, 8 lines)
β β£ββ MyType
β β£ββ class MyClass
β βββ class MyClass -> def my_method
βββ π group1 (402 tokens, 88 lines)
β£ββ π KotlinTest.kt (29 tokens, 4 lines)
β β£ββ data class Person(val name: String)
β βββ fun greet(person: Person)
β£ββ π JavaTest.java (47 tokens, 12 lines)
β β£ββ class Person
β β£ββ class Person -> Person(String name)
β βββ class Person -> void greet()
β£ββ π LispTest.lisp (31 tokens, 5 lines)
β β£ββ defstruct person
β βββ defun greet
β£ββ π ObjectiveCTest.m (59 tokens, 16 lines)
β β£ββ @interface HelloWorld
β β£ββ @interface HelloWorld -> (void) sayHello
β β£ββ @implementation HelloWorld
β β£ββ @implementation HelloWorld -> (void) sayHello
β βββ void sayHelloWorld()
β£ββ π LuaTest.lua (84 tokens, 16 lines)
β β£ββ function HelloWorld.new
β β£ββ function HelloWorld.greet
β βββ function say_hello
β£ββ π JuliaTest.jl (42 tokens, 12 lines)
β β£ββ module JuliaTest
β β£ββ module JuliaTest -> struct Person
β βββ module JuliaTest -> greet(p::Person)
β£ββ π OcamlTest.ml (53 tokens, 12 lines)
β β£ββ type color
β β£ββ class hello
β β£ββ class hello -> method say_hello
β βββ let main ()
βββ π COBOL_TEST.CBL (57 tokens, 11 lines)
β£ββ IDENTIFICATION DIVISION -> PROGRAM-ID. HELLO
β£ββ DATA DIVISION -> 01 GREETING
βββ PROCEDURE DIVISION