Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: Add printing of the style to zstyle+ through option -p



Hello,
I think that many of us often dreamed about omitting the output
parameter and the following print when checking out a value of style:

zstyle -s :the:style:path style the_parameter; print $the_parameter

I've stumbled upon the interesting function zstyle+ and I thought
about adding an option -p to it that would print the style:

zstyle+ -p :the:style:path style

The simple patch adds the option.
-- 
Sebastian Gniazdowski
News: https://twitter.com/ZdharmaI
IRC: https://kiwiirc.com/client/chat.freenode.net:+6697/#zplugin
Blog: http://zdharma.org
From 5f770ab08febe83adc5afbef44103139f98666a8 Mon Sep 17 00:00:00 2001
From: Sebastian Gniazdowski <sgniazdowski@xxxxxxxxx>
Date: Tue, 15 Oct 2019 20:49:18 +0200
Subject: [PATCH] =?UTF-8?q?Add=20option=20-p=20to=20zstyle+=20=E2=80=93=20?=
 =?UTF-8?q?printing=20of=20the=20style=20to=20the=20stdout?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 Functions/Misc/zstyle+ | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/Functions/Misc/zstyle+ b/Functions/Misc/zstyle+
index 81b4f0552..66a4eb34b 100644
--- a/Functions/Misc/zstyle+
+++ b/Functions/Misc/zstyle+
@@ -17,8 +17,14 @@
 # the completion functions are autoloaded without alias expansion (the
 # -U option to the autoload builtin). The completion system normally
 # loads its functions with without alias expansion.
+#
+# Tue Oct 15 20:38:16 CEST 2019
+# The option -p prints the value of the style. The normal usage is to
+# use it in place of the option -s and to omit the output parameter.
 
 case "$1" in
+-p) shift; local value; zstyle -s "$@" value; print -r -- "$value";;
+
 -*) zstyle "$@";;
 
 *)  setopt localoptions noksharrays
-- 
2.21.0



Messages sorted by: Reverse Date, Date, Thread, Author