Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
[PATCH] typeset -p doesn't report -U (unique) attribute
- X-seq: zsh-workers 43536
- From: Stephane Chazelas <stephane.chazelas@xxxxxxxxx>
- To: Zsh hackers list <zsh-workers@xxxxxxx>
- Subject: [PATCH] typeset -p doesn't report -U (unique) attribute
- Date: Mon, 24 Sep 2018 22:05:50 +0100
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:mime-version :content-disposition:user-agent; bh=r3lkZXBTo7F8IJpd1YCb2Q2fzXfpdkcOWGSfAdeDaaI=; b=JXKzjXLEwQ8iJX7rpwcy62DW9zSFb5lWzxwZ7LS5V028wDqcI6bUKusqOVVFIq4tXr gNLbK4xuH5VYW+n9wawe9Bn2RhM9kgAXIPA70fTcxF9SN5zVUIRgOdc+1tSpK3zv+n9S CncsB9roUFOfL3xO0vTze8kWTWoG6xUgnyBrpzd/uEz2yVe3j0IZgP+Ub1k/q5KQwcVx Lm1j/RjuoAXLx4NAeUw4XZ7abN41tO4dRP3AM8tTXcPFCxXw1S4nwG9tDaICjcZ2gYMG tA2hQWPSDKBU7SMQPLyjUjOftSThS1XDjk2USJGm31QmZS6vjZKSpIkfBjR72eqliWHo Nh0A==
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- List-unsubscribe: <mailto:zsh-workers-unsubscribe@zsh.org>
- Mail-followup-to: Zsh hackers list <zsh-workers@xxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
From:
https://unix.stackexchange.com/questions/470956/how-to-print-all-the-attributes-of-a-zsh-parameter
$ typeset -U a=(x x)
$ typeset -p a
typeset -a a=( x )
Expected:
$ typeset -p a
typeset -aU a=( x )
diff --git a/Src/params.c b/Src/params.c
index a1c299f60..f7ecff32a 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -5854,20 +5854,27 @@ printparamnode(HashNode hn, int printflags)
if ((pmptr->flags & PMTF_USE_BASE) && p->base) {
printf("%d ", p->base);
doneminus = 0;
}
if ((pmptr->flags & PMTF_USE_WIDTH) && p->width) {
printf("%d ", p->width);
doneminus = 0;
}
}
}
+ if (p->node.flags & PM_UNIQUE) {
+ if (!doneminus) {
+ putchar('-');
+ doneminus = 1;
+ }
+ putchar('U');
+ }
if (doneminus)
putchar(' ');
}
if ((printflags & PRINT_NAMEONLY) ||
((p->node.flags & PM_HIDEVAL) && !(printflags & PRINT_INCLUDEVALUE))) {
zputs(p->node.nam, stdout);
putchar('\n');
} else {
if (printflags & PRINT_KV_PAIR) {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author