mirror of
https://gitlab.com/mattia.basaglia/ASCII-Pony.git
synced 2024-11-24 21:08:00 +01:00
Simplify some stuff
This commit is contained in:
parent
cdd11d8b15
commit
0b068d2a1f
2 changed files with 13 additions and 11 deletions
7
Makefile
7
Makefile
|
@ -106,7 +106,7 @@ $(BINDIR):
|
|||
install: $(OUT_ALL)
|
||||
install: $(DATADIR)
|
||||
install: $(BINDIR)
|
||||
$(INSTALL_DIR) $(MAKEFILE_DIR)rendered $(DATADIR)
|
||||
$(INSTALL_DIR) $(OUT_DIR) $(DATADIR)
|
||||
$(INSTALL_FILE) $(MAKEFILE_DIR)systempony $(BINDIR)
|
||||
|
||||
uninstall:
|
||||
|
@ -116,5 +116,6 @@ uninstall:
|
|||
|
||||
#touch output files to avoid re-generations (eg: after cloning)
|
||||
touchput:
|
||||
find $(MAKEFILE_DIR)rendered -exec touch {} \;
|
||||
find $(MAKEFILE_DIR)rendered -name '*.png' -exec touch {} \;
|
||||
find $(PONY_DIR) -name '*.txt' -exec touch {} \;
|
||||
find $(OUT_DIR) -exec touch {} \;
|
||||
find $(OUT_DIR) -name '*.png' -exec touch {} \;
|
||||
|
|
17
systempony
17
systempony
|
@ -28,7 +28,7 @@ function ponyget_RAM()
|
|||
local ramtable=$(free -m)
|
||||
local used_M=$(echo "$ramtable" | sed -n 3p | sed -r "s/ +/\t/g" | cut -f 3)
|
||||
local total_M=$(echo "$ramtable" | sed -n 2p | sed -r "s/ +/\t/g" | cut -f 2)
|
||||
local percent=$(echo "$used_M * 100 / $total_M " | bc)
|
||||
let percent="$used_M * 100 / $total_M"
|
||||
|
||||
local color="32";
|
||||
if [ "$percent" -gt 66 ]
|
||||
|
@ -201,19 +201,20 @@ then
|
|||
lines=$(cat "$ponyfile" | wc -l) # cat to avoid printing file name
|
||||
let info_index=0
|
||||
let start_line=($lines-${#INFO[@]})/2
|
||||
for (( l=1; $l <= $lines; l++ ))
|
||||
|
||||
let l=1
|
||||
while IFS= read -r line
|
||||
do
|
||||
line=$(sed -n "$l{p;q}" "$ponyfile" )
|
||||
echo -n "$line"
|
||||
if [ $info_index -lt ${#INFO[@]} -a $l -ge $start_line ]
|
||||
then
|
||||
# TODO take in consideration $COLUMNS
|
||||
printf " \x1b[31;1m%-${maxkeyl}s\x1b[0m: %s" "${INFO[$info_index]}" "${infoval[$info_index]}"
|
||||
printf "%s \x1b[31;1m%-${maxkeyl}s\x1b[0m: %s\n" "$line" "${INFO[$info_index]}" "${infoval[$info_index]}"
|
||||
let info_index++
|
||||
else
|
||||
echo -ne "\x1b[0m"
|
||||
echo -n "$line"
|
||||
echo -e "\x1b[0m"
|
||||
fi
|
||||
echo
|
||||
done
|
||||
let l++
|
||||
done < "$ponyfile"
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue