From 6e7be87749c386cdb63ac2151458c36eb21a0f77 Mon Sep 17 00:00:00 2001 From: Ryan Delaney Date: Wed, 9 Mar 2022 11:18:44 -0500 Subject: [PATCH 1/6] Add pre-commit config --- .pre-commit-config.yaml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..32694a7 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,24 @@ +--- +repos: + - repo: meta + hooks: + - id: check-hooks-apply + - id: check-useless-excludes + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.1.0 + hooks: + - id: check-merge-conflict + - id: end-of-file-fixer + - id: trailing-whitespace + args: [--markdown-linebreak-ext=md] + + - repo: https://github.com/executablebooks/mdformat + rev: 0.7.13 + hooks: + - id: mdformat + additional_dependencies: + - mdformat-gfm + - mdformat-toc + +# EOF From f36b926653f92ab167f82a23e85145ebe50ecda4 Mon Sep 17 00:00:00 2001 From: Ryan Delaney Date: Wed, 9 Mar 2022 11:19:28 -0500 Subject: [PATCH 2/6] mdformat everything --- CONTRIBUTING.md | 4 ++-- README.markdown | 30 +++++++++++++++++++----------- 2 files changed, 21 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index f50686d..d5771f7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -7,5 +7,5 @@ The following is a set of guidelines for contributing to LS_COLORS ## Pull Request Process 1. Add the new file extension and its color to [`LS_COLORS`](./LS_COLORS). Try to find the most appropriate category for the file type and match the style to the others in the same category. -2. Run tests -3. Create a new pull request +1. Run tests +1. Create a new pull request diff --git a/README.markdown b/README.markdown index 88f5cb6..791970d 100644 --- a/README.markdown +++ b/README.markdown @@ -1,12 +1,14 @@ ### Table of contents -* [LS_COLORS](#ls_colors) -* [What does it look like?](#what-does-it-look-like) -* [Dependencies](#dependencies) -* [Installation](#installation) -* [Information for Developers](#information-for-developers) -* [Legal](#legal) + +- [LS_COLORS](#ls_colors) +- [What does it look like?](#what-does-it-look-like) +- [Dependencies](#dependencies) +- [Installation](#installation) +- [Information for Developers](#information-for-developers) +- [Legal](#legal) # LS_COLORS + This is a collection of extension:color mappings, suitable to use as your `LS_COLORS` environment variable. Most of them use the extended color map, described in the ECMA-48 document; in other words, you'll need a terminal @@ -26,15 +28,11 @@ try to pick colors that fits in nicely together. Filetypes with multiple possible extensions, like htm and html, should have the same color. # What does it look like? + Here's a screenshot _(font and minor color shades, of course, depend on terminal and its configuration)_: ![Screenshot1](docs/static/LS_COLORS.png) - [0]: https://github.com/trapd00r/zsh-syntax-highlighting-filetypes - [1]: https://github.com/trapd00r/File-LsColor - [2]: https://github.com/trapd00r/File-LsColor/tree/master/bin - [3]: https://aur.archlinux.org/packages/lscolors-git - # Dependencies You need GNU `dircolors` and a compatible directory listing tool, such as GNU @@ -47,11 +45,13 @@ The repo contains two compiled scripts `lscolors.sh` & `lscolors.csh`, which you To enable the colors, add the following line to your shell's start-up script: For Bourne shell (e.g. `~/.bashrc` or `~/.zshrc`): + ``` source ~/path/to/lscolors.sh ``` For C shell (e.g. `~/.cshrc`): + ``` source ~/path/to/lscolors.csh ``` @@ -72,14 +72,17 @@ $ ``` ## Arch Linux + Arch Linux users can install the [`lscolors-git`][3] package from the AUR for easy integration with bash, csh, or zsh. # Information for Developers + There's a [library][1] I've written that lets you use various LS COLORS on arbitrary files and directories. A simple implementation can be found [here][2]. Using this, you can do + ```shell find $HOME -maxdepth 1 | ls_color @@ -89,6 +92,7 @@ mpc search artist Laleh | ls_color ... and so on. # Legal + © Copyright 2014-2022 Magnus Woldrich. This program is distributed in the hope that it will be useful, but WITHOUT ANY @@ -101,3 +105,7 @@ either version 1.0 of the License, or (at your option) any later version. You should have received a copy of the Perl Artistic License along with this program. If not, see . + +[1]: https://github.com/trapd00r/File-LsColor +[2]: https://github.com/trapd00r/File-LsColor/tree/master/bin +[3]: https://aur.archlinux.org/packages/lscolors-git From 6161dfc6948392d69ef04408d105ca82b68fdd3c Mon Sep 17 00:00:00 2001 From: Ryan Delaney Date: Wed, 9 Mar 2022 11:22:37 -0500 Subject: [PATCH 3/6] Fix header formatting in readme --- README.markdown | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/README.markdown b/README.markdown index 791970d..966241e 100644 --- a/README.markdown +++ b/README.markdown @@ -1,4 +1,4 @@ -### Table of contents +# LS_COLORS - [LS_COLORS](#ls_colors) - [What does it look like?](#what-does-it-look-like) @@ -7,7 +7,7 @@ - [Information for Developers](#information-for-developers) - [Legal](#legal) -# LS_COLORS +## LS_COLORS This is a collection of extension:color mappings, suitable to use as your `LS_COLORS` environment variable. Most of them use the extended color map, @@ -27,18 +27,18 @@ For files that usually ends up next to each other, like html, css and js, try to pick colors that fits in nicely together. Filetypes with multiple possible extensions, like htm and html, should have the same color. -# What does it look like? +## What does it look like? Here's a screenshot _(font and minor color shades, of course, depend on terminal and its configuration)_: ![Screenshot1](docs/static/LS_COLORS.png) -# Dependencies +## Dependencies You need GNU `dircolors` and a compatible directory listing tool, such as GNU `ls`. Both are available in GNU coreutils. -# Installation +## Installation The repo contains two compiled scripts `lscolors.sh` & `lscolors.csh`, which you can download & source directly or point your plugin manager to pick up one of them. @@ -71,12 +71,12 @@ For C shell (e.g. ~/.cshrc): $ ``` -## Arch Linux +### Arch Linux Arch Linux users can install the [`lscolors-git`][3] package from the AUR for easy integration with bash, csh, or zsh. -# Information for Developers +## Information for Developers There's a [library][1] I've written that lets you use various LS COLORS on arbitrary files and directories. A simple implementation can be found [here][2]. @@ -91,7 +91,7 @@ mpc search artist Laleh | ls_color ... and so on. -# Legal +## Legal © Copyright 2014-2022 Magnus Woldrich. From 4e1b1ac1c69732292b152af777c4a343aff9cab2 Mon Sep 17 00:00:00 2001 From: Ryan Delaney Date: Wed, 9 Mar 2022 11:22:55 -0500 Subject: [PATCH 4/6] Manage TOC with mdformat --- README.markdown | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/README.markdown b/README.markdown index 966241e..dab73c3 100644 --- a/README.markdown +++ b/README.markdown @@ -1,13 +1,16 @@ # LS_COLORS -- [LS_COLORS](#ls_colors) -- [What does it look like?](#what-does-it-look-like) -- [Dependencies](#dependencies) -- [Installation](#installation) -- [Information for Developers](#information-for-developers) -- [Legal](#legal) + -## LS_COLORS +- [LS_COLORS](#ls_colors) + - [What does it look like?](#what-does-it-look-like) + - [Dependencies](#dependencies) + - [Installation](#installation) + - [Arch Linux](#arch-linux) + - [Information for Developers](#information-for-developers) + - [Legal](#legal) + + This is a collection of extension:color mappings, suitable to use as your `LS_COLORS` environment variable. Most of them use the extended color map, From b47f8fb264b979e0d6cf2cb7bd8a08a2e2a8d919 Mon Sep 17 00:00:00 2001 From: Ryan Delaney Date: Wed, 9 Mar 2022 11:33:26 -0500 Subject: [PATCH 5/6] Add github action for pre-commit checks --- .github/workflows/build.yml | 4 +++- .github/workflows/pre_commit.yaml | 26 ++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pre_commit.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f0f410d..4a3992a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,6 @@ +--- name: 'Release' + on: push: branches: [master] @@ -8,7 +10,7 @@ jobs: runs-on: ubuntu-latest steps: - name: 'Check out Git repository' - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: 'Generate shell files' run: make generate diff --git a/.github/workflows/pre_commit.yaml b/.github/workflows/pre_commit.yaml new file mode 100644 index 0000000..2aa217e --- /dev/null +++ b/.github/workflows/pre_commit.yaml @@ -0,0 +1,26 @@ +--- +name: pre-commit + +on: + pull_request: + push: + branches: [main] + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v3 + + - name: Install pre-commit + run: pip install pre-commit + + - name: cache + uses: actions/cache@v2 + with: + key: pre-commit-dot-cache-{{ checksum ".pre-commit-config.yaml" }} + path: ~/.cache/pre-commit + + - name: Pre-commit checks + run: pre-commit run --all-files --show-diff-on-failure From c00e8504b44deee8ca5e942e65cac96871328d77 Mon Sep 17 00:00:00 2001 From: Ryan Delaney Date: Wed, 9 Mar 2022 11:37:50 -0500 Subject: [PATCH 6/6] Add build badge to README --- README.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.markdown b/README.markdown index dab73c3..37518ca 100644 --- a/README.markdown +++ b/README.markdown @@ -1,5 +1,7 @@ # LS_COLORS +![Build](https://github.com/trapd00r/LS_COLORS/actions/workflows/build.yaml/badge.svg) + - [LS_COLORS](#ls_colors)