mirror of
https://github.com/oh-my-fish/oh-my-fish.git
synced 2025-01-20 19:03:58 +08:00
inline tbytes
This commit is contained in:
parent
8183877640
commit
01dc116a54
|
@ -1,7 +1,17 @@
|
||||||
function fish_prompt
|
function tbytes -d 'calculates the total size of the files in the current directory'
|
||||||
set -l script_dir (dirname (status -f))
|
set -l tBytes (ls -al | grep "^-" | awk 'BEGIN {i=0} { i += $5 } END { print i }')
|
||||||
. $script_dir/tbytes.fish
|
|
||||||
|
if test $tBytes -lt 1048576
|
||||||
|
set -g total (echo -e "scale=3 \n$tBytes/1048 \nquit" | bc)
|
||||||
|
set -g units " Kb"
|
||||||
|
else
|
||||||
|
set -g total (echo -e "scale=3 \n$tBytes/1048576 \nquit" | bc)
|
||||||
|
set -g units " Mb"
|
||||||
|
end
|
||||||
|
echo -n "$total$units"
|
||||||
|
end
|
||||||
|
|
||||||
|
function fish_prompt
|
||||||
set_color yellow
|
set_color yellow
|
||||||
printf '%s' (whoami)
|
printf '%s' (whoami)
|
||||||
set_color normal
|
set_color normal
|
||||||
|
|
|
@ -1,12 +0,0 @@
|
||||||
function tbytes -d 'calculates the total size of the files in the current directory'
|
|
||||||
set -g tBytes (ls -al | grep "^-" | awk 'BEGIN {i=0} { i += $5 } END { print i }')
|
|
||||||
|
|
||||||
if test $tBytes -lt 1048576
|
|
||||||
set -g total (echo -e "scale=3 \n$tBytes/1048 \nquit" | bc)
|
|
||||||
set -g units " Kb"
|
|
||||||
else
|
|
||||||
set -g total (echo -e "scale=3 \n$tBytes/1048576 \nquit" | bc)
|
|
||||||
set -g units " Mb"
|
|
||||||
end
|
|
||||||
echo -n "$total$units"
|
|
||||||
end
|
|
Loading…
Reference in New Issue
Block a user