improve output and error handling, use 1 script
[log-quiet] / logq-function
diff --git a/logq-function b/logq-function
deleted file mode 100644 (file)
index afe722f..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-logq () {
-    local help="Usage: logq [-h|--help] COMMAND [ARG...]
-
-Log Quietly. Run COMMAND with ARGs, log to temp file. Output return code,
-command, and log path.
-
-Minor details: Use logsave if available, which adds informational header/footer
-to log file.  Logfile is put in random temp dir, with filename made from the
-alphanumeric characters of COMMAND + ARGs."
-
-    if [[ $1 == --help || $1 == -h ]]; then
-        echo "$help"
-        return
-    fi
-    if [[ $# == 0 ]]; then
-       echo "error: need 1 or more arguments
-$help"
-       return 1
-    fi
-
-    local index=0
-    local x prettycommand
-    for x in "$@"; do
-        prettycommand+="[$index]$x "
-        index=$(( index+1 ))
-    done
-
-
-    local file="$*"
-    file="$(mktemp -d)/${file//[^[:alnum:]]/}"
-
-    printf "%s\n%s\n\n" "log of $prettycommand" "$(date)" >"$file"
-
-    # we will propagate any errors
-    local e=$-
-    [[ $e == *e* ]] && set +e
-    "$@" &>> "$file"
-    local ret=$?
-    [[ $e == *e* ]] && set -e
-
-    printf "\n%s\n%s\n%s" "----------------" "$(date)" "end of log" >>"$file"
-
-    echo -n "\$?=$ret "
-    echo -n "$prettycommand"
-    echo "[log] $file"
-    return $ret
-}