Fix redirecting issues
authorCase Duckworth <acdw@acdw.net>
Sun, 24 May 2020 00:46:22 +0000 (19:46 -0500)
committerCase Duckworth <acdw@acdw.net>
Sun, 24 May 2020 00:46:22 +0000 (19:46 -0500)
bollux

diff --git a/bollux b/bollux
index b63e645..b9d1443 100755 (executable)
--- a/bollux
+++ b/bollux
@@ -45,7 +45,7 @@ END_USAGE
 
 ### utility functions ###
 # a better echo
-put() { printf '%s\n' "$*" >&3; }
+put() { printf '%s\n' "$*"; }
 
 # conditionally log events to stderr
 # lower = more important
@@ -91,7 +91,7 @@ die() { # die [EXIT-CODE] MESSAGE
 ask() { # ask PROMPT [READ_OPT...]
        prompt="$1"
        shift
-       read -e -r -u 3 -p "$prompt> " "$@"
+       read </dev/tty -e -r -p "$prompt> " "$@"
 }
 
 # fail if something isn't installed
@@ -271,8 +271,9 @@ download() { # download URL < FILE
 
 ### main entry point ###
 bollux() {
-       # use &3 for user input
-       exec 3<>/dev/tty
+       OPTIND=0
+       process_cmdline "$@"
+       shift $((OPTIND - 1))
 
        if (($# == 1)); then
                URL="$1"