Small python program select tree (and change) it using curses standard library.
- Linux Terminal
- Mac Terminal
In virtualenv,
(python) $ pip install treesel
or just for system python interpreter,
$ sudo pip install treesel
$ treesel $HOME
will show directory tree structure from $HOME. If first parameter is omitted then treesel will show directory tree structure from current directory.
if -s
or --show_hidden
option is given hidden directory will be showen, default is not show hidden directory.
For example,
$ treesel -s
- UP, DOWN - navigation between directories
- RIGHT - expand sub-directories
- LEFT - unexpand
- ENTER - select the directory
- ESC - cancel treesel
$ cd "$(treesel -s $HOME)"
If you are using bash
then use pushd
insread of cd
.
$ pushd "$(treesel -s $HOME)"
After working at that directory you can just popd
to return original directory.
$ popd
You can add a alias at your home profile,
tree_select() {
pushd "$(treesel $@)"
}
alias ts=tree_select
And to work this alias make sure,
$ source ~/.bashrc
In the long run,
$ ts
$ ts ~
I will be happy if you are happy!
Now python curses standard library does not support UTF-8 encoding. Please let me know If someone know how to solve this problem.