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. From AUR
    3. 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!

From AUR

AUR (Arch Linux)

yay -S laser-git

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 ~/.lsr/. But if you want to write some own configuration you can place it in ~/.config/lsr/lsr.lua.

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

Check out the configuration guide for more information.

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 / --all Displays hidden files.

  • -D / --Directories Displays only directories.

  • -F / --Files Displays only files.

  • -S / --Symlinks Displays only symbolic links.

  • -G / --Git Combines the --git-status and --git-ignore flags.

    • Defaults to use the current directory as git repo.
    • To specify a Git repository: -G/path/to/git/repo or --Git=/path/to/git/repo.
  • -g / --git-status Displays the Git status of files.

    • Defaults to use the current directory as git repo.
    • To specify a Git repository: -g/path/to/git/repo or --git-status=/path/to/git/repo.
    • Lowercase letters as a status means that the file is not staged. And uppercase letters mean that the file is staged.
    • Status letters:
      • A = added
      • M = modified
      • R = renamed
      • T = type changed
  • -i / --git-ignore Displays Git-ignored files.

    • Defaults to use the current directory as git repo.
    • To specify a Git repository: -i/path/to/git/repo or --git-ignore=/path/to/git/repo.
  • -r / --recursive Displays the directory tree structure.

    • Optional depth: Specify a maximum depth with -r2 or --recursive=2.
    • Default: Expands to the last level.
  • -l / --long Displays detailed file information, including permissions, last modified date, size, and owner.

  • -fmyfilter / --filter=myfilter Applies a user-defined filter written in Lua.

Contributing

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

Authors