A modern alternative to the ls
command inspired by Nushell's output, written in Ruby.
- Tabular output with colors
- Column filtering via command line
- High performance through lazy loading
- Mac and Linux support
- Install gem (recommended)
gem install lsd-rb
- Use the installation script
git clone https://github.com/aristotelesbr/lsd
cd lsd
./install.sh
- Manual installation
The installation script will:
-
Check if Ruby is installed (>= 3.0)
-
Install necessary dependencies
bundle install
-
Compile the program if needed
chmod +x bin/lsd
-
Move the binary to
/usr/local/bin
# List current directory
lsd
# List a specific directory
lsd ~/Downloads
# Filter by name and type only
lsd --filter-by "name,type"
# Show help
lsd --help
- name: File/directory name
- size: Size in human format (KB, MB, etc)
- type: File type (file, directory, symlink)
- modified: Modification date
The index column (#) is always shown.
.
├── bin/
│ └── lsd # Main executable
├── lib/
│ ├── lsd.rb # Main code
│ ├── entry.rb # Directory entry class
│ └── formatter.rb # Table formatting
├── install.sh # Installation script
└── README.md # This documentation
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and the created tag, and push the .gem
file to rubygems.org.
We welcome contributions to LSD! Here's how you can help:
- Fork the project
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Make your changes
- Run the tests to ensure everything passes (
bundle exec rake
) - Commit your changes (
git commit -am 'Add amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Create a new Pull Request
This project follows Ruby Standard Style. All pull requests must pass style checks before they can be merged. You can automatically fix most style issues with:
bundle exec rake standard:fix
We maintain high test coverage in this project. All new features or bug fixes should include tests. Current test coverage is 90%.
To run the test suite with coverage report:
bundle exec rake
The coverage report will be generated in the coverage
directory.
- Ensure your code follows the project's style guide (Ruby Standard)
- Update the CHANGELOG.md with details of your changes
- Include tests for your changes
- Update documentation if needed
- The PR template will guide you through the required information
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the LSD project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.