tree to markdown command

This commit is contained in:
Malin Freeborn 2024-04-06 01:04:43 +02:00
parent 38bcdd15cc
commit f666ac3dc9
Signed by: andonome
GPG Key ID: 52295D2377F4D70F
2 changed files with 33 additions and 1 deletions

View File

@ -1,6 +1,6 @@
--- ---
title: "tree" title: "tree"
tags: [ "basics" ] tags: [ "basics", "tree", "markdown" ]
--- ---
The `tree` utility outputs a full listing of everything in your current directory, and those below. The `tree` utility outputs a full listing of everything in your current directory, and those below.
@ -23,3 +23,14 @@ README.md
``` ```
Each description-line starts with a tab. Each description-line starts with a tab.
## Markdown Conversion
To represent a file structure as a nested series of markdown lists, you can try this horrifying `sed` one-liner:
```bash
tree -tf --dirsfirst --gitignore --noreport --charset ascii | \
sed -e 's/| \+/ /g' \
-e 's/[|`]-\+/ */g' \
-e 's:\(* \)\(\(.*/\)\([^/]\+\)\):\1[\4](\2):g'
```

21
data/sqlite.md Normal file
View File

@ -0,0 +1,21 @@
---
title: "sqlite"
tags: [ "Documentation", "data" ]
---
Work with a database:
```bash
sqlite3 "$FILE".sqlite3
```
Compress the database:
```sqlite
pragma vacuum;
```
Optimize the database:
```sqlite
pragma optimize;
```