Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port root before_v0.60/*.nu scripts (issue #221) #837

Merged
merged 7 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 '\\' '/')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking this should probably be str replace '\\' '/' --all, otherwise it just replaces the first one I think.

let file_name = ($file_path | path basename)
$"[($file_name)](char lparen)./($file_path)(char rparen)"
})
Expand Down
Loading