From 7228492a12b5c2d19179e815eef88a0dbdb7df75 Mon Sep 17 00:00:00 2001 From: robocopAlpha <35454738+robocopAlpha@users.noreply.github.com> Date: Tue, 4 Aug 2020 00:49:07 +0300 Subject: [PATCH] update files --- README.md | 2 +- brewlog.sh | 23 +++++++++++++---------- install.sh | 2 ++ 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 56a51a0..65813e2 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ Now you'll be easily able to track the changes made by `brew upgrade`or `brew cl ### How to use ```sh -curl -sSL 'install.sh' | bash +curl -sSL 'https://raw.githubusercontent.com/robocopAlpha/brewlog/master/install.sh' | bash # Show help brewlog --help diff --git a/brewlog.sh b/brewlog.sh index 2993e28..49be191 100644 --- a/brewlog.sh +++ b/brewlog.sh @@ -21,14 +21,13 @@ Usage: brewlog [brew command] [arguments to homebrew] e.g. brewlog install ffmpeg, invokes "brew install ffmpeg" and writes output to a log file. - - --help Show help - --brew-help show brew commands (alias to "brew help") - -OPTIONS: - version Show brewlog version - archive Archives the current log file as .xz - tail [-n INT] Show the last "INT" lines from the log file. + +OPTIONS: + --help Show help + --brew-help Show brew commands (alias to "brew help") + version Show brewlog version info + archive Archives the current log file as .xz + tail [-n INT] Show the last "INT" lines from the log file. (default: last 15 lines) Homebrew/Linuxbrew Function examples: @@ -52,7 +51,6 @@ Follow the development: https://github.com/robocopAlpha/brewlog '; } -VERSION if [ ! -f "$LOGFILE" ] ; then # Creating brew.log @@ -60,11 +58,16 @@ if [ ! -f "$LOGFILE" ] ; then mkdir -p "$(dirname "$LOGFILE")" touch "$LOGFILE" fi + +if [ $# -eq 0 ]; then + HELP +fi + if [ "$1" == "--help" ]; then HELP elif [ "$1" == "--brew-help" ]; then brew help -elif [ "$1" == "--brew-help" ]; then +elif [ "$1" == "version" ]; then VERSION elif [ "$1" == "tail" ]; then if [ "$2" == "-n" ]; then diff --git a/install.sh b/install.sh index 9a19922..1ff6a92 100644 --- a/install.sh +++ b/install.sh @@ -1,3 +1,5 @@ +#!/bin/bash + if [ -w /usr/local/bin ]; then curl -sSL 'https://raw.githubusercontent.com/robocopAlpha/brewlog/master/brewlog.sh' > /usr/local/bin/brewlog chmod +x /usr/local/bin/brewlog