Skip to content
/ laser Public

basically `ls` but `lsr`, and configurable with lua!

License

Notifications You must be signed in to change notification settings

jmattaa/laser

Repository files navigation

Laser

(lsr) Basically ls but readable

demo

Table of contents

  1. Installation
    1. From Homebrew
    2. Building from source
  2. Usage
    1. Configure
    2. Command-line options
  3. Contributing
  4. Authors

lsr basically ls but with colorization and sorting for better readability. It offers filtering options, making it easy to locate specific files and folders (with grep you'll find exactly what you need) It can even display the directory contents in a tree-like structure! 🔥 If that wasn't enough you can even extend the program with lua! (I'm too proud of that )

Installation

From Homebrew

Homebrew (MacOS and Linux)

brew tap jmattaa/laser
brew install --formula laser

By installing with Homebrew, you get the shell completions for the cli as well!

Building from source

Clone the repository:

git clone https://github.com/jmattaa/laser.git
cd laser

Install system-wide:

cmake -S . -B build
cmake --build build
sudo cmake --install build

To uninstall you can run the following while being in the laser directory:

sudo cmake --build build --target uninstall

Note

This dosen't install the shell completions for the cli but you can add them by placing the files from the completions directory in a directory that is in your $PATH. Or source the file from your bashrc, zshrc or config.fish file.

Usage

After installing you can run laser in your current directory by simply running:

lsr
# or for a specific directory run:
lsr some-directory

Configure

If you'd like to configure the program's behavior, or change the default colors, add icons and more. You can configure the program with lua 🔥. A default configuration will be installed at $HOME/.lsr/. But if you want to write some own configuration you can place it in ~/.config/lsr/lsr.lua.

Copy the files from $HOME/.lsr to ~/.config/lsr/ and you can edit them (do not change in the files in the $HOME/.lsr directory because they will be used as default if there are missing values in the .config).

Check out the configuration guide

Command-line options

The command-line options can be added by passing flags. These flags can be put before or after the directory you want to search, if there is no directory you can directly pass in the flags.

  • -a or --all shows hidden files
  • -D or --Directories shows only directories
  • -F or --Files shows only files
  • -S or --Symlinks shows only symlinks
  • -G or --Git shows only the entries that are not named in .gitignore (works only if there exists a .gitignore)
  • -r or --recursive shows directory tree structure
    • -r or --recursive has an optional value for max depth and it can be used by using -r2 or --recursive=2 by default the depth is until last level
  • -l or --long displays in long format (permissions, last modified, size and owner)

The flags can be chained for example using:

lsr -Dar # this will show all directories including hidden ones recursivly
lsr -GDS # this will only show directories (not hidden) and symlinks that are not mentioned in .gitignore

Contributing

Feel free to contribute to this project to make it better 🚀 check the CONTRIBUTING.md and follow the guidlines from there!

Authors