Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Note

You can do some cool stuff with the filters, if you have some good filters please reach out and get them showcased. 🔥

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.

  • -s / --directory-size Displays the physical disk usage of the all the subdirectories. (will force the -l/--long flag and the -a/--all flag)

  • -c / --ensure-colors Ensures that the output is colorized even if output is redirected to another file than stdout (e.g. lsr > file.txt or lsr | less).

  • -n / --no-sort Dissables sorting. (The speed difference between sorting and not sorting is really small, got an idea to make it faster? open an issue)

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

  • -! / --no-lua Ignores the ~/.config/lsr/lsr.lua file and runs without user config and user defined filters.

Contributing

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

Authors

About

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

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Contributors 4

  •  
  •  
  •  
  •