mirror of
https://github.com/Cian-H/dotfiles.git
synced 2025-12-26 04:41:58 +00:00
This change allows the dotfiles to work with chezmoi (e.g: on windows) and improves grepability with neovim/telescope
23 lines
724 B
Nu
23 lines
724 B
Nu
# duplicates returns the rows that correspond to duplicates of the given column.
|
|
export def duplicates [
|
|
column: string # Column to look duplicates at
|
|
--count(-c) # set it to display the number of times the value is repeated.
|
|
] {
|
|
group-by {get $column | into string} |
|
|
transpose |
|
|
insert count { $in.column1 | flatten | length } |
|
|
where count > 1 |
|
|
reject column0 |
|
|
if ($count | is-empty) { reject count } else { each { $in } } |
|
|
flatten |
|
|
flatten
|
|
}
|
|
|
|
# duplicates files recursively finds duplicate files in the current working folder.
|
|
# It uses a heuristic based on duplicate files having the same size.
|
|
export def "duplicates files" [] {
|
|
do -i {ls **/*} | duplicates size
|
|
}
|
|
|
|
|