mirror of
https://github.com/oh-my-fish/oh-my-fish
synced 2024-11-03 15:40:32 +00:00
inline tbytes
This commit is contained in:
parent
8183877640
commit
01dc116a54
@ -1,7 +1,17 @@
|
||||
function fish_prompt
|
||||
set -l script_dir (dirname (status -f))
|
||||
. $script_dir/tbytes.fish
|
||||
function tbytes -d 'calculates the total size of the files in the current directory'
|
||||
set -l 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
|
||||
|
||||
function fish_prompt
|
||||
set_color yellow
|
||||
printf '%s' (whoami)
|
||||
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