Skip to content

Commit a0e6973

Browse files
authored
Port root before_v0.60/*.nu scripts (issue nushell#221) (nushell#837)
This PR is part of porting all old scripts nushell#221 and ports all root `before_v0.60/*.nu` scripts to `modules/*.nu`
1 parent bb814f1 commit a0e6973

File tree

5 files changed

+11
-154
lines changed

5 files changed

+11
-154
lines changed

before_v0.60/bin-utils.nu

Lines changed: 0 additions & 77 deletions
This file was deleted.

before_v0.60/fehbg.nu

Lines changed: 0 additions & 64 deletions
This file was deleted.

before_v0.60/lint_directories.nu renamed to modules/lint_directories.nu

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# - 1.0.1 is a valid directory name.
44
# - yeah_whatever_linter is not a valid directory name.
55
def ls-incorrect-dirs [] {
6-
ls | where type == 'Dir' and name != 'scripts'| match -v name '(\d+\.){2,}\d$'
6+
ls | where type == dir and name != 'scripts' | find --invert --regex '(\d+\.){2,}\d$' --columns [name]
77
}
88
let incorrect_count = (ls-incorrect-dirs | length);
99
if $incorrect_count > 0 {
10-
# echo `The following directories are named incorrectly: {{(char newline)}}`
11-
$"The following directories are named incorrectly: (char newline)"
12-
ls-incorrect-dirs
13-
exit 1
14-
} {
15-
exit 0
10+
print $"The following directories are named incorrectly: (char newline)"
11+
print (ls-incorrect-dirs)
12+
exit 1
13+
14+
} else {
15+
exit 0
1616
}

before_v0.60/maintainer_time.nu renamed to modules/maintainer_time.nu

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ let m_table = (
1212
]
1313
)
1414
let now = (date now)
15-
$m_table | update time {
16-
each { |name|
17-
$now | date to-timezone ($name | get tz) | date format '%c'
18-
}
15+
$m_table | update time {|row|
16+
$now | date to-timezone ($row | get tz) | format date '%c'
1917
}
2018

before_v0.60/make_readme_table.nu renamed to modules/make_readme_table.nu

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@ let nu_table = ($nu_files |
1717
let cat = ($it.File | path dirname)
1818
if $cat == "" {
1919
"not assigned yet"
20-
} {
20+
} else {
2121
$cat
2222
}
2323
} | where Category !~ ".git" | select Category File | sort-by Category)
2424

2525
# Let's fix the file now
2626
let nu_table = ($nu_table | update File { |it|
27-
let file_path = ($it.File | into string | str find-replace '\\' '/')
27+
let file_path = ($it.File | into string | str replace '\' '/' --all)
2828
let file_name = ($file_path | path basename)
2929
$"[($file_name)](char lparen)./($file_path)(char rparen)"
3030
})

0 commit comments

Comments
 (0)