mirror of
https://github.com/RGBCube/nu_scripts
synced 2025-08-01 06:37:46 +00:00
This PR is part of porting all old scripts #221 and ports all root `before_v0.60/*.nu` scripts to `modules/*.nu`
This commit is contained in:
parent
bb814f1173
commit
a0e69735ed
5 changed files with 11 additions and 154 deletions
16
modules/lint_directories.nu
Normal file
16
modules/lint_directories.nu
Normal file
|
@ -0,0 +1,16 @@
|
|||
# List any directory that does not follow a SemVer naming pattern
|
||||
# For example
|
||||
# - 1.0.1 is a valid directory name.
|
||||
# - yeah_whatever_linter is not a valid directory name.
|
||||
def ls-incorrect-dirs [] {
|
||||
ls | where type == dir and name != 'scripts' | find --invert --regex '(\d+\.){2,}\d$' --columns [name]
|
||||
}
|
||||
let incorrect_count = (ls-incorrect-dirs | length);
|
||||
if $incorrect_count > 0 {
|
||||
print $"The following directories are named incorrectly: (char newline)"
|
||||
print (ls-incorrect-dirs)
|
||||
exit 1
|
||||
|
||||
} else {
|
||||
exit 0
|
||||
}
|
18
modules/maintainer_time.nu
Normal file
18
modules/maintainer_time.nu
Normal file
|
@ -0,0 +1,18 @@
|
|||
let m_table = (
|
||||
[
|
||||
['name', 'tz', 'time'];
|
||||
['andres' 'America/Guayaquil' ' ']
|
||||
['fdncred' 'US/Central' ' ']
|
||||
['gedge' 'US/Eastern' ' ']
|
||||
['jt' 'NZ' ' ']
|
||||
['wycats' 'US/Pacific' ' ']
|
||||
['kubouch' 'Europe/Helsinki' ' ']
|
||||
['elferherrera' 'Europe/London' ' ']
|
||||
['storm' 'US/Pacific' ' ']
|
||||
]
|
||||
)
|
||||
let now = (date now)
|
||||
$m_table | update time {|row|
|
||||
$now | date to-timezone ($row | get tz) | format date '%c'
|
||||
}
|
||||
|
32
modules/make_readme_table.nu
Normal file
32
modules/make_readme_table.nu
Normal file
|
@ -0,0 +1,32 @@
|
|||
# A Script to try and create the table for the readme.md file
|
||||
# | 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.
|
||||
|
||||
let nu_files = (ls **/*.nu)
|
||||
let nu_table = ($nu_files |
|
||||
get name |
|
||||
wrap File |
|
||||
insert Category { |it|
|
||||
let cat = ($it.File | path dirname)
|
||||
if $cat == "" {
|
||||
"not assigned yet"
|
||||
} else {
|
||||
$cat
|
||||
}
|
||||
} | where Category !~ ".git" | select Category File | sort-by Category)
|
||||
|
||||
# Let's fix the file now
|
||||
let nu_table = ($nu_table | update File { |it|
|
||||
let file_path = ($it.File | into string | str replace '\' '/' --all)
|
||||
let file_name = ($file_path | path basename)
|
||||
$"[($file_name)](char lparen)./($file_path)(char rparen)"
|
||||
})
|
||||
|
||||
echo $nu_table | to md --pretty
|
Loading…
Add table
Add a link
Reference in a new issue