This commit is contained in:
Amber 2024-01-18 09:39:40 +01:00
parent a11761ac01
commit 1ecc40fddd
5 changed files with 22 additions and 1 deletions

View File

@ -1,4 +1,5 @@
# Nerd tree
An ugly version of the unix-like tree command and a visual version of find command that shows the results found in a visual tree.
All written in python language.
Branch is unstable and under development

Binary file not shown.

18
src/colors.py Normal file
View File

@ -0,0 +1,18 @@
def RED(s):
return "\033[01;31m%s\033[00m" % (str(s))
def YELLOW(s):
return "\033[01;33m%s\033[00m" % (str(s))
def GREEN(s):
return "\033[01;32m%s\033[00m" % (str(s))
def CYAN(s):
return "\033[01;36m%s\033[00m" % (str(s))
def BLUE(s):
return "\033[01;34m%s\033[00m" % (str(s))
def PURPLE(s):
return "\033[01;35m%s\033[00m" % (str(s))

View File

@ -1,5 +1,7 @@
import os
from colors import RED, YELLOW, GREEN, CYAN , BLUE, PURPLE
EMPTY_TREE_LINE_LENGTH = 160
EMPTY_TREE_LINE = ' ' * EMPTY_TREE_LINE_LENGTH
@ -70,7 +72,7 @@ def nerd_tree_from_struct(rootnode, prec_seps=[]):
## rootnode is always a dir -> colorize
rootnode_name = rootnode['name']
nerd_tree_txt = 'd_' + rootnode_name
nerd_tree_txt = CYAN(rootnode_name)
items = rootnode.get('children') or []