An open API service indexing awesome lists of open source software.

https://github.com/mike-ward/lsv

lsv - Vlang implementation of ls
https://github.com/mike-ward/lsv

Last synced: about 2 months ago
JSON representation

lsv - Vlang implementation of ls

Awesome Lists containing this project

README

          

# lsv - Vlang implementation of `ls`

`lsv` is a modern alternative to `ls` in the spirit of `exa, eza, lsd, pls, natls, ls-go` and others.

![Screenshot](screenshot.jpeg)

Border format with header option
![Screenshot](screenshot2.jpeg)

## Features

- Single binary with no external dependencies!
- Not written in Rust 😮 (see below)
- Color output based on LS_COLORS
- Table format (long format)
- Column Headers (long format)
- Blocked output (long format)
- Icons
- Checksum (md5, sha1, sha224, sha256, sha512, blake2b)
- Friendly file sizes and dates
- Nearly as fast as GNU `ls`
- Robust recursion. Try `lsv -R /`
- Options similar to `ls`

## Installing

### Build `lsv` from source.

- [Install the V compiler](https://docs.vlang.io/installing-v-from-source.html). It takes a minute or less
- `git clone https://github.com/mike-ward/lsv.git`
- `cd lsv`
- `make`
- `bin/lsv`

### Binaries

[Latest Release](https://github.com/mike-ward/lsv/releases/latest)

### Homebrew

We need 75 stars to publish to Homebrew. Star the repo to help us get there!

## Help
```
lsv
-----------------------------------------------
Usage: lsv [options] [FILES]

Description: List information about FILES

Options:
-a include files starting with .
-A do not list implied . and ..
-c color the listing
-D append / to directories
-F show full path
-i show file icon (requires nerd fonts)
-l long listing format (see Long Listing Options)
-m list of files separated by commas
-q enclose files in quotes
-R list subdirectories recursively
-X list files by lines instead of by columns
-1 list one file per line

--depth limit depth of recursion
--width set output width to

Filtering and Sorting Options:
-d list only directories
-f list only files
-g sort directories before files
-r reverse the listing order
-s sort by file size, largest first
-t sort by time, newest first
-v sort digits within text as numbers
-w sort by width, shortest first
-x sort by file extension
-u no sorting

--after after modified time
--after-access after access time
--after-change after change time
--before before modified time
--before-access before access time
--before-change before change time

where time is an ISO 8601 format.
See: https://ijmacd.github.io/rfc3339-iso8601

--ignore ignore glob patterns (pipe-separated)
--ignore-case ignore case when sorting

Long Listing Options:
-b blank line every 5 rows
-B add borders to long listing format
-, sizes comma separated by thousands
-k sizes in kibibytes (1024) (e.g. 1k 234m 2g)
-K sizes in Kilobytes (1000) (e.g. 1kb 234mb 2gb)
-# show entry number
-n show owner and group IDs as numbers
-o show octal permissions
-p show relative path
-C show last status changed date
-E show last accessed date
-H show column headers
-I show time in iso format
-J show time in compact format
-L show time in compact format with week day
-T show relative time
-M show mime type
-N show inodes

--cs show file checksum
(md5, sha1, sha224, sha256, sha512, blake2b)
--no-counts hide file/dir counts
--no-date hide date (modified)
--no-dim hide shading; useful for light backgrounds
--no-group hide group name
--no-hard-links hide hard links count
--no-owner hide owner name
--no-permissions hide permissions
--no-size hide file size
--no-wrap do not wrap long lines
--zero end each output line with NUL, not newline

-h, --help display this help and exit
--version output version information and exit

The -c option emits color codes when standard output is
connected to a terminal. Colors are defined in the LS_COLORS
environment variable.
```

## Why?

It started with writing a `ls` implementation for the V Language CoreUtils project.
Coreutils is a reimplementation of the POSIX and GNU utility programs written in the V Language. Everything was going fine until I started having too much fun and down the "rabbit hole" I went.

What's this V language? You can read about it [here](https://vlang.io/), but the short version is it is a simple, fast, safe, compiled language for developing maintainable software. I mentioned `lsv` is not written in Rust. I'm not trashing Rust. Rust is obviously a robust and popular language. However, it's a steep climb to get up to speed and requires a fair bit of cognitive load to use it well.

V is the opposite. It has many of the same safety features of Rust, but without the cognitive overhead. Its simple, straightforward syntax makes it a breeze to write. Builds happen in milliseconds, not minutes and hours. You don't need any special build tools like Gradle.

Finally, take a look at the `lsv` codebase. The entire codebase is **2K lines** 🧐. Furthermore, the implementation is straightforward. No threading, coroutines or fancy memory management. Even if you don't know V, I'm betting you will understand the code.

## Helping Out

See CONTRIBUTING.md for more information