-
-
Notifications
You must be signed in to change notification settings - Fork 541
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Use lib_getopt for all hooks and some style tweaks (#137)
- Loading branch information
1 parent
0c5cbb3
commit 1d8af37
Showing
4 changed files
with
99 additions
and
1,075 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|
@@ -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: | ||
|
@@ -122,7 +122,7 @@ getopt() { | |
return 4 ;; | ||
|
||
(-V|--version) | ||
echo "pure-getopt 1.4.3" | ||
echo "pure-getopt 1.4.4" | ||
return 0 ;; | ||
|
||
(--) | ||
|
@@ -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 | ||
|
@@ -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=' ' | ||
|
Oops, something went wrong.