From 34d583aaf8ad210bcd6025e819224636c822e1b1 Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Tue, 3 Mar 2020 01:57:23 -0500 Subject: Use getopts in shell scripts WTF why did no one tell me about this? --- bin/up.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'bin') diff --git a/bin/up.sh b/bin/up.sh index 0ff9e69b..8b70de70 100644 --- a/bin/up.sh +++ b/bin/up.sh @@ -58,17 +58,16 @@ uploadTerminal() { upload "${temp}/term.html" } -args=$(setopt 'chst' "$@") -eval set -- "$args" -for opt; do +while getopts 'chst' opt; do case "$opt" in - (-c) shift; fn=uploadCommand;; - (-h) shift; fn=uploadHi;; - (-s) shift; fn=uploadScreen;; - (-t) shift; fn=uploadTerminal;; - (--) shift; break;; + (c) fn=uploadCommand;; + (h) fn=uploadHi;; + (s) fn=uploadScreen;; + (t) fn=uploadTerminal;; + (?) exit 1;; esac done +shift $(($OPTIND - 1)) [ $# -eq 0 ] && : ${fn:=uploadText} : ${fn:=upload} -- cgit 1.4.1 d> summary refs log tree commit diff
path: root/bin/cash/libedit/search.h (unfollow)
Commit message (Expand)Author
2019-02-18Match Tag in RustJune McEnroe
2019-02-18Match sh functions as TagJune McEnroe
2019-02-18Match Sh and Ss as Tag in mdocJune McEnroe
2019-02-18Match statics and typedefs as TagJune McEnroe
2019-02-18Clean up htmlHeaderJune McEnroe
2019-02-18Remove hi line numberingJune McEnroe
2019-02-18Add Tag class to hiJune McEnroe
2019-02-17Generate HTML with hi -n -f html -o anchorJune McEnroe
2019-02-17Add hi -f html -o anchor for line number linksJune McEnroe
2019-02-17Simplify temp trap in upJune McEnroe
2019-02-17Add line numbers to hiJune McEnroe
2019-02-17Always split spans after newlinesJune McEnroe
2019-02-15Color format specifiers light cyan in vimJune McEnroe
2019-02-15Highlight Interp as yellowJune McEnroe
2019-02-15Highlight strings in sh command substitutionsJune McEnroe
2019-02-15Add nmap gpJune McEnroe
2019-02-14Avoid newline when copying URL to pasteboardJune McEnroe
2019-02-13Add forgotten "sixth" book of H2G2June McEnroe