Lists specified directories recursively with a tree view, similar to tree(1).
I made this mostly to learn common lisp, since tree already does this faster and better.
To use lstree, you will need Clozure CL (other common lisp implementations may not work due to the use of the directory function) and git.
To install Clozure CL, either grab the latest github release or use your distribution's package manager if it's available there.
If you dont already have it, git is in most distribution's package managers, for example (run these as root):
Ubuntu based:
apt install git
Arch based:
pacman -S git
Fedora:
dnf install git
First, you need to clone the github repository:
$ git clone https://github.com/lilyyllyyllyly/lstree
$ cd lstree
From here you have two options: create an application to use from the command line, or using it directly from the REPL.
To create an application using Clozure CL, first load the lstree.cl
file:
$ ccl -l lstree.cl
And in the REPL run the following function:
(save-application "lstree" :toplevel-function #'main :prepend-kernel t)
This will quit the REPL and create a binary that can be run directly.
More information about this function can be found in the Clozure CL Documentation.
See how to use the resulting program in Command Line Usage.
The function used to list the contents of a directory is dir-contents.
It's definition is the following:
(defun dir-contents (&key path padding max-depth follow-links depth) ...)
The keyword parameters are equivalent to the command line options shown in Command Line Usage.
The path defaults to the current directory and padding defaults to 2.
Usage: lstree [OPTION...] [DIRECTORY...]
List contents of DIRECTORY(s) recursively, with a tree view.
If no DIRECTORY is specified, lists contents of the current directory.
Long options do not use an equal sign (=). Unrecognized options are treated as paths.
-h, --help show this help page
-m, --max-depth DEPTH descend at most DEPTH directories
-f, --follow-links follow symbolic or hard links and show their directory contents
-p, --padding VALUE separate inner files/directories with VALUE spaces