Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use lib_getopt for all hooks and some style tweaks #137

Merged
merged 6 commits into from
Aug 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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