nu_scripts/make_readme_table.nu

34 lines
1.4 KiB
Plaintext
Raw Normal View History

# A Script to try and create the table for the readme.md file
2021-05-19 15:50:57 +03:00
# | Category | File |
# | ---------------- | ----------------------------------------------------------------------------- |
# | coloring | [24bit-1.nu](./coloring\24bit-1.nu) |
# | coloring | [color_table.nu](./coloring\color_table.nu) |
# | coloring | [color_tables.nu](./coloring\color_tables.nu) |
# | coloring | [gradient.nu](./coloring\gradient.nu) |
# Right now there is still manual manipulation in order to update the README.md
# Hopefully, in the future someone will contribute a script to make this automatic.
2021-05-19 15:50:57 +03:00
let nu_files = (ls **/*.nu)
let nu_table = (echo $nu_files |
get name |
2021-05-19 15:50:57 +03:00
wrap File |
2021-05-25 00:24:34 +03:00
insert Category { |it|
let cat = (echo $it.File | path dirname)
if $cat == "" {
2021-05-24 21:37:07 +03:00
"not assigned yet"
} {
2021-05-24 21:37:07 +03:00
$cat
}
2021-05-19 15:50:57 +03:00
} | where Category !~ ".git" | select Category File | sort-by Category)
# Let's fix the file now
2021-05-25 00:24:34 +03:00
let nu_table = (echo $nu_table | update File { |it|
let file_path = (echo $it.File)
2021-05-19 15:50:57 +03:00
let file_name = (echo $file_path | path basename)
let file_link = (build-string "[" $file_name "]" "(./" $file_path ")")
echo $file_link
})
2021-05-24 21:37:07 +03:00
$nu_table | to md --pretty