mirror of
https://github.com/notwa/rc
synced 2024-11-04 20:19:02 -08:00
remove cdbusiest and rename dbusiest to busiest
This commit is contained in:
parent
4dbafc41ca
commit
cc4d682c9c
2 changed files with 8 additions and 34 deletions
|
@ -4,16 +4,15 @@
|
|||
# NO_DASH
|
||||
# NO_ASH
|
||||
|
||||
dbusiest() { ### @-
|
||||
### list directories ordered descending by the number of files in them,
|
||||
### counted recursively. see also [`cdbusiest`.](#cdbusiest)
|
||||
busiest() { ### @-
|
||||
### list directories in descending order by the number of files in them,
|
||||
### counted recursively.
|
||||
###
|
||||
### ```
|
||||
### $ cd
|
||||
### $ dbusiest | head -n3
|
||||
### 152364 src
|
||||
### 46518 work
|
||||
### 20903 play
|
||||
### $ cd && busiest | head -n3
|
||||
### 144181 src
|
||||
### 48840 work
|
||||
### 21042 play
|
||||
### ```
|
||||
[ $# -le 0 ] || { printf "%s\n" "$0: too many arguments" >&2; return 1; }
|
||||
local c d
|
||||
|
@ -25,4 +24,4 @@ dbusiest() { ### @-
|
|||
[ -z $d ] && return 1
|
||||
}
|
||||
|
||||
[ -n "${preload+-}" ] || dbusiest "$@"
|
||||
[ -n "${preload+-}" ] || busiest "$@"
|
25
sh/cdbusiest
25
sh/cdbusiest
|
@ -1,25 +0,0 @@
|
|||
#!/usr/bin/env zsh
|
||||
# YES_ZSH
|
||||
# NO_BASH
|
||||
# NO_DASH
|
||||
# NO_ASH
|
||||
|
||||
cdbusiest() { ### @-
|
||||
### cd to the directory with the most files in it, counted recursively.
|
||||
###
|
||||
### ```
|
||||
### $ cd
|
||||
### $ cdbusiest
|
||||
### 152364 src
|
||||
### $ pwd
|
||||
### /home/notwa/src
|
||||
### ```
|
||||
dbusiest | read -r c d
|
||||
[ -z $c ] && return 1
|
||||
printf "%s\n" "$c $d"
|
||||
cd $d
|
||||
}
|
||||
|
||||
[ -n "${preload+-}" ] || . ~/sh/preload || exit 2
|
||||
eval ${preload:-preload} dbusiest
|
||||
[ -n "${preload+-}" ] || cdbusiest "$@"
|
Loading…
Reference in a new issue