add tool to sort .gitignore content

We sort with lines starting with # first.
We sort with lines starting with * second.
We sort with lines that do not start with [#!*] third.
We sort with lines starting with ! fourth.

Example usage in vim with a keyboard macro <escape>f:

```vim
:map ^[f 1G!G../../bin/sgi^M
```

 or via .vimrc:

```vimrc
" sort the entire .gitignore file using ../../bin/sgi
:map  ^[f 1G!G../../bin/sgi^M
```

 NOTE: The ^[ above is ((Escape)) and ^M is ((Control-M)).

Example usage in shell:

```sh
rm -f t && ../../bin/sgi < .gitignore > t && mv -f t .gitignore
```

Suggested usage:

```sh
bin/all-run.sh bin/sort.gitignore -v 1
```

Sorted all winner .gitignore according to this method.
Sorted all year level .gitignore according to this method.
Sorted top level .gitignore according to this method.
This commit is contained in:
Landon Curt Noll committed 2024-02-01 14:35:49 -08:00
1 parent 5619029d33
commit 657a0be130
341 files changed
+919 -447

No files matched your search

+27
View File
@@ -91,6 +91,33 @@ bin/all-run.sh -v 3 bin/readme2index.sh -v 1
Convert README.md into index.html.
### [sgi](sgi)
Sort .gitignore content from stdin to stdout.
We sort with lines starting with # first.
We sort with lines starting with * second.
We sort with lines that do not start with [#!*] third.
We sort with lines starting with ! fourth.
### [sort.gitignore](sort.gitignore)
Sort a .gitignore in a winner directory.
Usage:
```sh
bin/sort.gitignore -v 1 YYYY/dir
```
Suggested usage:
```sh
bin/all-run.sh bin/sort.gitignore -v 1
```
### [subst.default.sh](subst.default.sh)
Print default substitutions.