Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: _cdcd tweaks
- X-seq: zsh-workers 16662
- From: Clint Adams <clint@xxxxxxx>
- To: zsh-workers@xxxxxxxxxx
- Subject: PATCH: _cdcd tweaks
- Date: Sun, 17 Feb 2002 11:44:15 -0500
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
This removes the use of sed, grep, and seq. I was tempted to "unroll"
the function calls, but decided that it wouldn't buy much.
Index: Completion/Unix/Command/_cdcd
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Command/_cdcd,v
retrieving revision 1.1
diff -u -r1.1 _cdcd
--- Completion/Unix/Command/_cdcd 14 Feb 2002 17:56:54 -0000 1.1
+++ Completion/Unix/Command/_cdcd 17 Feb 2002 16:39:35 -0000
@@ -4,17 +4,17 @@
_cdcd_tracks ()
{
- cdcd info | sed -e 1,2d -e 4d -e "s,Total tracks: *\([0-9]\+\).*,\1,"
+ print ${${${(f)"$(cdcd info)"}[3]}/Total tracks: #(#b)([0-9]##)*/$match[1]}
}
_cdcd_track_list ()
{
- seq 1 $(_cdcd_tracks)
+ print ${1..$(_cdcd_tracks)}
}
_cdcd_track_list_verbose ()
{
- cdcd tracks | grep "^[ 0-9]\+:" | sed -e 's,^ *\([0-9]\+\):[ >]*. *[^ ]* *\(.*\) \+,\1\\\:\"\2\",'
+ print ${${(M)${(f)"$(cdcd tracks)"}:#(#s) #[0-9]##:*}/(#s) #(#b)([0-9]##):[ >]#? #[^ ]# #(*) ##/$match[1]:${(qqq)match[2]}}
}
_cdcd_commands ()
Messages sorted by:
Reverse Date,
Date,
Thread,
Author