mirror of
https://github.com/dchakro/brewlog.git
synced 2026-05-17 10:12:16 -07:00
Updates
use gzip as fallback if xz is not installed on system Add Paypal donation link
This commit is contained in:
parent
e8013f9e0a
commit
00b50313ac
2 changed files with 15 additions and 5 deletions
|
|
@ -102,7 +102,7 @@ e.g.
|
||||||
|
|
||||||
OPTIONS:
|
OPTIONS:
|
||||||
version Show brewlog version
|
version Show brewlog version
|
||||||
archive Archives the current log file as .xz
|
archive Archives the current log file as .xz (gzip as fallback if xz not found)
|
||||||
tail [-n INT] Show the last "INT" lines from the log file.
|
tail [-n INT] Show the last "INT" lines from the log file.
|
||||||
(default: last 15 lines)
|
(default: last 15 lines)
|
||||||
|
|
||||||
|
|
@ -116,7 +116,9 @@ Homebrew/Linuxbrew Function examples:
|
||||||
Find out more homebrew commands by running "brew --help".
|
Find out more homebrew commands by running "brew --help".
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you found `brewlog` consider starring this repo.
|
||||||
|
|
||||||
|
[](https://paypal.me/robocopAlpha)
|
||||||
|
|
||||||
### Notice about the command `brew log`:
|
### Notice about the command `brew log`:
|
||||||
|
|
||||||
|
|
|
||||||
12
brewlog.sh
12
brewlog.sh
|
|
@ -26,7 +26,7 @@ OPTIONS:
|
||||||
--help Show help
|
--help Show help
|
||||||
--brew-help Show brew commands (alias to "brew help")
|
--brew-help Show brew commands (alias to "brew help")
|
||||||
version Show brewlog version info
|
version Show brewlog version info
|
||||||
archive Archives the current log file as .xz
|
archive Archives the current log file as .xz (gzip as fallback if xz not found)
|
||||||
tail [-n INT] Show the last "INT" lines from the log file.
|
tail [-n INT] Show the last "INT" lines from the log file.
|
||||||
(default: last 15 lines)
|
(default: last 15 lines)
|
||||||
|
|
||||||
|
|
@ -86,9 +86,17 @@ elif [ "$1" == "tail" ]; then
|
||||||
elif [ "$1" == "archive" ]; then
|
elif [ "$1" == "archive" ]; then
|
||||||
if [ -f "$LOGFILE" ] ; then
|
if [ -f "$LOGFILE" ] ; then
|
||||||
# Archiving logfile i.e. brew.log is removed (will be created on next run)
|
# Archiving logfile i.e. brew.log is removed (will be created on next run)
|
||||||
xz -vf $LOGFILE
|
command -v xz > /dev/null
|
||||||
|
if [ "$?" -eq "0" ]; then
|
||||||
|
xz -6vf $LOGFILE
|
||||||
mv "${LOGFILE}.xz" "$LOGFILE-$(date +'%Y%m%d').xz"
|
mv "${LOGFILE}.xz" "$LOGFILE-$(date +'%Y%m%d').xz"
|
||||||
exit 0;
|
exit 0;
|
||||||
|
else
|
||||||
|
# if xz is unavailable use gz
|
||||||
|
gzip -6fv $LOGFILE
|
||||||
|
mv "${LOGFILE}.gz" "$LOGFILE-$(date +'%Y%m%d').gz"
|
||||||
|
exit 0;
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
echo "$LOGFILE doesn't exist"
|
echo "$LOGFILE doesn't exist"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue