GithubHelp home page GithubHelp logo

lstree's Introduction

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.

Installation and Usage

Installing dependencies

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

Running the Program

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.

Creating Standalone Application (Clozure CL only)

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.

Using Inside the REPL

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.

Command Line Usage

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

lstree's People

Contributors

lilyyllyyllyly avatar

Stargazers

Evelyn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.