From 5ddd3322d1c9a5ecc9dcdf69fa7cc41cf8548473 Mon Sep 17 00:00:00 2001 From: Alex <54222750+linguisticmind@users.noreply.github.com> Date: Thu, 20 Jun 2024 08:10:42 +0000 Subject: [PATCH] Fixed incorrect handling of options to `sed`. A `sed` filter would break if the script part (which follows the options string) contained a double hyphen (`--`) surrounded by one or more spaces. --- CHANGELOG.md | 11 +++++++++++ README.md | 17 ++++------------- man/man1/pretty-declare-print.1 | 2 +- pretty-declare-print | 4 ++-- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9cf175a..a09cede 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,17 @@ Date Description + + + 0.1.6 + + + 2024-06-20 + + + Fixed incorrect handling of options to sed. A sed filter would break if the script part (which follows the options string) contained a double hyphen (--) surrounded by one or more spaces. + + 0.1.5 diff --git a/README.md b/README.md index 5d03766..b109646 100644 --- a/README.md +++ b/README.md @@ -20,22 +20,13 @@ Video tutorial: - 0.1.5 + 0.1.6 - 2024-06-01 + 2024-06-20 -

- IMPORTANT: Fixed a bug where the closing parenthesis of an array consisting of a single element wouldn't get printed when breaking up arrays into multiple lines was disabled (-M, --no-multiline-arrays). -

-

- Now, -c, --color / -C, --no-color also affects colorization of the output in names mode.
- bat's --paging is now always set to never in names mode. -

-

- Fixed formatting in the CHANGELOG file. -

+ Fixed incorrect handling of options to sed. A sed filter would break if the script part (which follows the options string) contained a double hyphen (--) surrounded by one or more spaces. @@ -489,7 +480,7 @@ COPYRIGHT This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. -PRETTY-DECLARE-PRINT 0.1.5 2024 PRETTY-DECLARE-PRINT(1) +PRETTY-DECLARE-PRINT 0.1.6 2024 PRETTY-DECLARE-PRINT(1) ``` ## License diff --git a/man/man1/pretty-declare-print.1 b/man/man1/pretty-declare-print.1 index d5992e2..bed5bf8 100644 --- a/man/man1/pretty-declare-print.1 +++ b/man/man1/pretty-declare-print.1 @@ -1,4 +1,4 @@ -.TH PRETTY-DECLARE-PRINT 1 2024 PRETTY-DECLARE-PRINT\ 0.1.5 +.TH PRETTY-DECLARE-PRINT 1 2024 PRETTY-DECLARE-PRINT\ 0.1.6 .SH NAME pretty-declare-print \- prettify output of `declare -p` diff --git a/pretty-declare-print b/pretty-declare-print index 943f349..c47095d 100755 --- a/pretty-declare-print +++ b/pretty-declare-print @@ -16,7 +16,7 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -version=0.1.5 +version=0.1.6 getopt -T > /dev/null [[ $? != 4 ]] && { printf '[%s] %s\n' "${BASH_SOURCE##*/}" 'Enhanced getopt is required to run this script.' >&2; exit 1; } @@ -507,7 +507,7 @@ printf '%s\0%s\n%s\n' "$lib_dir" "$(declare -p opt_sort_associative_arrays opt_m [[ $arg ]] && sed_opts+=("$arg") done < <(<<<"${sed_script%%+([[:space:]])--+([[:space:]])*}" xargs printf '%s\0') fi - sed_script="${sed_script##*+([[:space:]])--+([[:space:]])}" + sed_script="${sed_script##+([[:space:]])--+([[:space:]])}" data=$(<<<"$data" sed "${sed_opts[@]}" "$sed_script") done printf '%s\n' "$data"