added lsd

This commit is contained in:
tracer 2020-01-26 15:08:34 +01:00
parent 3ab57f209d
commit da5855133d
6 changed files with 528 additions and 0 deletions

203
lsd/Linux/LICENSE Normal file
View File

@ -0,0 +1,203 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

159
lsd/Linux/README.md Normal file
View File

@ -0,0 +1,159 @@
# LSD (LSDeluxe)
[![license](http://img.shields.io/badge/license-Apache%20v2-orange.svg)](https://raw.githubusercontent.com/Peltoche/ical-rs/master/LICENSE)
[![Build Status](https://travis-ci.org/Peltoche/lsd.svg?branch=master)](https://travis-ci.org/Peltoche/lsd)
[![Latest version](https://img.shields.io/crates/v/lsd.svg)](https://crates.io/crates/lsd)
[![Snap Status](https://build.snapcraft.io/badge/Peltoche/lsd.svg)](https://build.snapcraft.io/user/Peltoche/lsd)
# Table of Contents
- [Description](#description)
- [Screenshot](#screenshot)
- [Installation](#installation)
- [Configurations](#configurations)
* [Required](#required)
* [Optional](#optional)
- [Benchmark](#benchmark)
- [F.A.Q.](#faq)
- [Contributors](#contributors)
- [Credits](#credits)
## Description
This project is heavily inspired by the super [colorls](https://github.com/athityakumar/colorls)
project but with some little differences. For example it is written in rust and not in ruby which makes it much faster ([see the benchmarks](#benchmark)).
## Screenshot
![image](https://raw.githubusercontent.com/Peltoche/lsd/assets/screen_lsd.png)
## Installation
### Prerequisites
Install the patched fonts of powerline nerd-font and/or font-awesome. Have a look at the [Nerd Font README](https://github.com/ryanoasis/nerd-fonts/blob/master/readme.md) for more installation instructions. Don't forget to setup your terminal in order to use the correct font.
See [this issue comment](https://github.com/Peltoche/lsd/issues/199#issuecomment-494218334) for detailed instructions on how to configure iTerm2 font settings correctly.
### On Archlinux
```sh
pacman -S lsd
```
### On Fedora
```sh
dnf install lsd
```
### On Ubuntu
_... and other Debian-based Linux distributions_
Download the latest .deb package from the [release page](https://github.com/Peltoche/lsd/releases) and install it via:
```sh
sudo dpkg -i lsd_7.2.0_amd64.deb # adapt version number and architecture
```
### On Gentoo
```sh
sudo emerge sys-apps/lsd
```
(Ebuild maintained by Georgy Yakovlev)
### From Snap
```sh
sudo snap install lsd
```
### On macOS
via [Homebrew](https://brew.sh/):
```sh
brew install lsd
```
### From Sources
With Rust's package manager cargo, you can install lsd via:
```sh
cargo install lsd
```
### From Binaries
The [release page](https://github.com/Peltoche/lsd/releases) includes precompiled binaries for Linux and macOS.
## Configurations
### Required
In order to use lsd instead of the default ls you need to add this to you shell
configuration file (~/.bashrc, ~/.zshrc, etc.) :
```sh
alias ls='lsd'
```
### Optional
Some examples of useful aliases. You can add this to you shell configuration
file (~/.bashrc, ~/.zshrc, etc.) just under the alias above :
```sh
alias l='ls -l'
alias la='ls -a'
alias lla='ls -la'
alias lt='ls --tree'
```
## Benchmark
Result from `hyperfine --warmup 10 'lsd -la /etc/*' 'colorls -la /etc/*' 'exa -la /etc/*' --export-markdown out.md`:
| Command | Mean [ms] | Min…Max [ms] |
|:---|---:|---:|
| `lsd -la /etc/*` | 9.8 ± 0.7 | 8.6…11.9 |
| `colorls -la /etc/*` | 387.3 ± 4.1 | 379.8…393.6 |
| `exa -la /etc/*` | 15.4 ± 1.8 | 14.0…24.0 |
## F.A.Q.
### Default Colors
In the future the possibility to customize the colors might be implemented.
For now, the default colors are:
| User/Group | Permissions | File Types | Last time Modified | File Size |
|:---|:---|:---|:---|:---|
|![#ffffd7](https://placehold.it/17/ffffd7/000000?text=+) User|![#00d700](https://placehold.it/17/00d700/000000?text=+) Read |![#0087ff](https://placehold.it/17/0087ff/000000?text=+) Directory|![#00d700](https://placehold.it/17/00d700/000000?text=+) within the last hour|![#ffffaf](https://placehold.it/17/ffffaf/000000?text=+) Small File|
|![#d7d7af](https://placehold.it/17/d7d7af/000000?text=+) Group|![#d7ff87](https://placehold.it/17/d7ff87/000000?text=+) Write|![#00d700](https://placehold.it/17/00d700/000000?text=+) Executable File|![#00d787](https://placehold.it/17/00d787/000000?text=+) within the last day|![#ffaf87](https://placehold.it/17/ffaf87/000000?text=+) Medium File|
||![#af0000](https://placehold.it/17/af0000/000000?text=+) Execute|![#d7d700](https://placehold.it/17/d7d700/000000?text=+) Non-Executable File|![#00af87](https://placehold.it/17/00af87/000000?text=+) older|![#d78700](https://placehold.it/17/d78700/000000?text=+) Large File|
||![#ff00ff](https://placehold.it/17/ff00ff/000000?text=+) Execute with Stickybit|![#af0000](https://placehold.it/17/af0000/000000?text=+) Broken Symlink||![#ffffff](https://placehold.it/17/ffffff/000000?text=+) Non File|
||![#d75f87](https://placehold.it/17/d75f87/000000?text=+) No Access|![#00d7d7](https://placehold.it/17/00d7d7/000000?text=+) Pipe/Symlink/Blockdevice/Socket/Special|||
|||![#d78700](https://placehold.it/17/d78700/000000?text=+) CharDevice|||
## Contributors
Everyone can contribute to this project, improving the code or adding functions. If anyone wants something to be added we will try to do it.
As this is being updated regularly, don't forget to rebase your fork before creating a pull-request.
## Credits
Special thanks to:
- [meain](https://github.com/meain) for all his contributions and reviews
- [danieldulaney](https://github.com/danieldulaney) for the Windows integration
- [sharkdp](https://github.com/sharkdp) and his superb [fd](https://github.com/sharkdp/fd) from which I have stolen a lot of CI stuff.
- [athityakumar](https://github.com/athityakumar) for the project [colorls](https://github.com/athityakumar/colorls)
- All the other contributors

View File

@ -0,0 +1,68 @@
#compdef lsd
autoload -U is-at-least
_lsd() {
typeset -A opt_args
typeset -a _arguments_options
local ret=1
if is-at-least 5.2; then
_arguments_options=(-s -S -C)
else
_arguments_options=(-s -C)
fi
local context curcontext="$curcontext" state line
_arguments "${_arguments_options[@]}" \
'*--color=[When to use terminal colours]: :(always auto never)' \
'*--icon=[When to print the icons]: :(always auto never)' \
'*--icon-theme=[Whether to use fancy or unicode icons]: :(fancy unicode)' \
'--depth=[Stop recursing into directories after reaching specified depth]' \
'*--size=[How to display size]: :(default short bytes)' \
'*--date=[How to display date]: :(date relative)' \
'*--group-dirs=[Sort the directories then the files]: :(none first last)' \
'*--blocks=[Specify the blocks that will be displayed and in what order]: :(permission user group size date name)' \
'*-a[Do not ignore entries starting with .]' \
'*--all[Do not ignore entries starting with .]' \
'*-A[Do not list implied . and ..]' \
'*--almost-all[Do not list implied . and ..]' \
'*-F[Append indicator (one of */=>@|) at the end of the file names]' \
'*--classify[Append indicator (one of */=>@|) at the end of the file names]' \
'*-l[Display extended file metadata as a table]' \
'*--long[Display extended file metadata as a table]' \
'*-1[Display one entry per line]' \
'*--oneline[Display one entry per line]' \
'(--tree)*-R[Recurse into directories]' \
'(--tree)*--recursive[Recurse into directories]' \
'-h[For ls compatibility purposes ONLY, currently set by default]' \
'--human-readable[For ls compatibility purposes ONLY, currently set by default]' \
'(-R --recursive)*--tree[Recurse into directories and present the result as a tree]' \
'(-a --all -A --almost-all --depth -R --recursive --tree)-d[Display directories themselves, and not their contents]' \
'(-a --all -A --almost-all --depth -R --recursive --tree)--directory-only[Display directories themselves, and not their contents]' \
'*--total-size[Display the total size of directories]' \
'*-t[Sort by time modified]' \
'*--timesort[Sort by time modified]' \
'*-S[Sort by size]' \
'*--sizesort[Sort by size]' \
'*-r[Reverse the order of the sort]' \
'*--reverse[Reverse the order of the sort]' \
'--classic[Enable classic mode (no colors or icons)]' \
'*--no-symlink[Do not display symlink target]' \
'--help[Prints help information]' \
'-V[Prints version information]' \
'--version[Prints version information]' \
'::FILE:_files' \
&& ret=0
}
(( $+functions[_lsd_commands] )) ||
_lsd_commands() {
local commands; commands=(
)
_describe -t commands 'lsd commands' commands "$@"
}
_lsd "$@"

View File

@ -0,0 +1,73 @@
_lsd() {
local i cur prev opts cmds
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
cmd=""
opts=""
for i in ${COMP_WORDS[@]}
do
case "${i}" in
lsd)
cmd="lsd"
;;
*)
;;
esac
done
case "${cmd}" in
lsd)
opts=" -a -A -F -l -1 -R -h -d -t -S -r -V --all --almost-all --classify --long --oneline --recursive --human-readable --tree --directory-only --total-size --timesort --sizesort --reverse --classic --no-symlink --help --version --color --icon --icon-theme --depth --size --date --group-dirs --blocks <FILE>... "
if [[ ${cur} == -* || ${COMP_CWORD} -eq 1 ]] ; then
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
fi
case "${prev}" in
--color)
COMPREPLY=($(compgen -W "always auto never" -- ${cur}))
return 0
;;
--icon)
COMPREPLY=($(compgen -W "always auto never" -- ${cur}))
return 0
;;
--icon-theme)
COMPREPLY=($(compgen -W "fancy unicode" -- ${cur}))
return 0
;;
--depth)
COMPREPLY=($(compgen -f ${cur}))
return 0
;;
--size)
COMPREPLY=($(compgen -W "default short bytes" -- ${cur}))
return 0
;;
--date)
COMPREPLY=($(compgen -W "date relative" -- ${cur}))
return 0
;;
--group-dirs)
COMPREPLY=($(compgen -W "none first last" -- ${cur}))
return 0
;;
--blocks)
COMPREPLY=($(compgen -W "permission user group size date name" -- ${cur}))
return 0
;;
*)
COMPREPLY=()
;;
esac
COMPREPLY=( $(compgen -W "${opts}" -- ${cur}) )
return 0
;;
esac
}
complete -F _lsd -o bashdefault -o default lsd

View File

@ -0,0 +1,25 @@
complete -c lsd -n "__fish_use_subcommand" -l color -d 'When to use terminal colours' -r -f -a "always auto never"
complete -c lsd -n "__fish_use_subcommand" -l icon -d 'When to print the icons' -r -f -a "always auto never"
complete -c lsd -n "__fish_use_subcommand" -l icon-theme -d 'Whether to use fancy or unicode icons' -r -f -a "fancy unicode"
complete -c lsd -n "__fish_use_subcommand" -l depth -d 'Stop recursing into directories after reaching specified depth'
complete -c lsd -n "__fish_use_subcommand" -l size -d 'How to display size' -r -f -a "default short bytes"
complete -c lsd -n "__fish_use_subcommand" -l date -d 'How to display date' -r -f -a "date relative"
complete -c lsd -n "__fish_use_subcommand" -l group-dirs -d 'Sort the directories then the files' -r -f -a "none first last"
complete -c lsd -n "__fish_use_subcommand" -l blocks -d 'Specify the blocks that will be displayed and in what order' -r -f -a "permission user group size date name"
complete -c lsd -n "__fish_use_subcommand" -s a -l all -d 'Do not ignore entries starting with .'
complete -c lsd -n "__fish_use_subcommand" -s A -l almost-all -d 'Do not list implied . and ..'
complete -c lsd -n "__fish_use_subcommand" -s F -l classify -d 'Append indicator (one of */=>@|) at the end of the file names'
complete -c lsd -n "__fish_use_subcommand" -s l -l long -d 'Display extended file metadata as a table'
complete -c lsd -n "__fish_use_subcommand" -s 1 -l oneline -d 'Display one entry per line'
complete -c lsd -n "__fish_use_subcommand" -s R -l recursive -d 'Recurse into directories'
complete -c lsd -n "__fish_use_subcommand" -s h -l human-readable -d 'For ls compatibility purposes ONLY, currently set by default'
complete -c lsd -n "__fish_use_subcommand" -l tree -d 'Recurse into directories and present the result as a tree'
complete -c lsd -n "__fish_use_subcommand" -s d -l directory-only -d 'Display directories themselves, and not their contents'
complete -c lsd -n "__fish_use_subcommand" -l total-size -d 'Display the total size of directories'
complete -c lsd -n "__fish_use_subcommand" -s t -l timesort -d 'Sort by time modified'
complete -c lsd -n "__fish_use_subcommand" -s S -l sizesort -d 'Sort by size'
complete -c lsd -n "__fish_use_subcommand" -s r -l reverse -d 'Reverse the order of the sort'
complete -c lsd -n "__fish_use_subcommand" -l classic -d 'Enable classic mode (no colors or icons)'
complete -c lsd -n "__fish_use_subcommand" -l no-symlink -d 'Do not display symlink target'
complete -c lsd -n "__fish_use_subcommand" -l help -d 'Prints help information'
complete -c lsd -n "__fish_use_subcommand" -s V -l version -d 'Prints version information'

BIN
lsd/Linux/lsd Executable file

Binary file not shown.