Skip to content

Commit

Permalink
chore: Use lib_getopt for all hooks and some style tweaks (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
robinbowes authored Aug 27, 2020
1 parent 0c5cbb3 commit 1d8af37
Show file tree
Hide file tree
Showing 4 changed files with 99 additions and 1,075 deletions.
12 changes: 6 additions & 6 deletions lib_getopt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

getopt() {
# pure-getopt, a drop-in replacement for GNU getopt in pure Bash.
# version 1.4.3
# version 1.4.4
#
# Copyright 2012-2018 Aron Griffis <[email protected]>
# Copyright 2012-2020 Aron Griffis <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
Expand Down Expand Up @@ -37,7 +37,7 @@ getopt() {
# "options -- parameters" on stdout.

declare parsed status
declare short long name flags
declare short long='' name flags=''
declare have_short=false

# Synopsis from getopt man-page:
Expand Down Expand Up @@ -122,7 +122,7 @@ getopt() {
return 4 ;;

(-V|--version)
echo "pure-getopt 1.4.3"
echo "pure-getopt 1.4.4"
return 0 ;;

(--)
Expand Down Expand Up @@ -367,7 +367,7 @@ getopt() {
# status 2.) If there is no match at all, prints a message on stderr
# and returns 2.
declare a q="$1"
declare -a matches
declare -a matches=()
shift
for a; do
if [[ $q == "$a" ]]; then
Expand Down Expand Up @@ -410,7 +410,7 @@ getopt() {

_getopt_quote() {
# Quotes arguments with single quotes, escaping inner single quotes
declare s space q=\'
declare s space='' q=\'
for s; do
printf "$space'%s'" "${s//$q/$q\\$q$q}"
space=' '
Expand Down
Loading

0 comments on commit 1d8af37

Please sign in to comment.