Skip to content

Commit

Permalink
Port root before_v0.60/*.nu scripts (issue #221) (#837)
Browse files Browse the repository at this point in the history
This PR is part of porting all old scripts #221 and ports all root
`before_v0.60/*.nu` scripts to `modules/*.nu`
  • Loading branch information
39555 authored May 13, 2024
1 parent bb814f1 commit a0e6973
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 154 deletions.
77 changes: 0 additions & 77 deletions before_v0.60/bin-utils.nu

This file was deleted.

64 changes: 0 additions & 64 deletions before_v0.60/fehbg.nu

This file was deleted.

14 changes: 7 additions & 7 deletions before_v0.60/lint_directories.nu → modules/lint_directories.nu
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# - 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'| match -v name '(\d+\.){2,}\d$'
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 {
# echo `The following directories are named incorrectly: {{(char newline)}}`
$"The following directories are named incorrectly: (char newline)"
ls-incorrect-dirs
exit 1
} {
exit 0
print $"The following directories are named incorrectly: (char newline)"
print (ls-incorrect-dirs)
exit 1

} else {
exit 0
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ let m_table = (
]
)
let now = (date now)
$m_table | update time {
each { |name|
$now | date to-timezone ($name | get tz) | date format '%c'
}
$m_table | update time {|row|
$now | date to-timezone ($row | get tz) | format date '%c'
}

Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ let nu_table = ($nu_files |
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 find-replace '\\' '/')
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)"
})
Expand Down

0 comments on commit a0e6973

Please sign in to comment.