zsh-workers
 help / color / mirror / code / Atom feed
* forwarding to the list.
@ 1997-01-04 11:30 Richard Coleman
  1997-01-04 11:39 ` (off-topic) " Daniel Reish
  0 siblings, 1 reply; 2+ messages in thread
From: Richard Coleman @ 1997-01-04 11:30 UTC (permalink / raw)
  To: zsh-workers

I think the mailing list manager thought this was
a subscription request, so I don't think it got
through.  So I'm forwarding it to the list.

rc

------- Forwarded Message

From: Xris Laas <chrisl@cybercom.net>
Sender: The Root Of All Evil <root@cybercom.net>
Subject: Compctl for tar -- how to submit to contrib?
To: zsh-workers@math.gatech.edu

I wrote a pretty good (not bugfree, but works 99% of the time for me)
compctl function.  It semi-parses the options, and if the action is
extract (x), list (t), or diff (d), it completes other arguments as
files *within* the archive.  Of course, it doesn't work with the
archive as STDIN (-), for obvious reasons.  I'm not sure how to submit
it to the contrib archive/source distribution, but I figured if I post
it on the list, it'll make its way there eventually.  Here it is:

Filename: tar-complete-function
---CUT HERE---
#!/bin/zsh
# tar-complete-function
# This is used with the compctl command.  Put this file into your Zsh
# function autoload directory, and put this in your .zshrc:
#
# compctl -K tar-complete-function \
#	-x 'C[-1,-*C][-1,--directory]' -g '(|.)*(-/)' \
#	-  'C[-1,-*f][-1,--file], p[2] W[1,*f]' -f \
#	-  'C[-1,-*T][-1,--files-from]' -f \
#	-  'C[-1,-*X][-1,--exclude-from]' -f \
#	-  'c[-1,--use-compress-program]' -c \
#	-- tar
# autoload tar-complete-function
#
# I also like to use these aliases with this:
# alias untar='tar xvf'
# alias lstar='tar tvf'
# alias zuntar='tar xzvf'
# alias zlstar='tar tzvf'

local comp cmdline action file zopt list elem
comp=$1
read -Ac cmdline
set $cmdline
shift
1=${1#-}
action=${1[1]}
1=-$1
file=""
while [[ "$1" != "" ]]; do
	if [[ $1 == -*f* && $1 != --* ]]; then
		file=${1#-*f}
		if [[ "$file" == "" ]]; then
			file=$2
			shift
		fi
	elif [[ "$1" == "--file" ]]; then
		file=$2
		shift
	fi
	shift
done
if [[ "$file" == "" ]]; then
	file=-
fi
case $action in
	A) reply=(${comp}*.tar) ;;
	c|r|u) reply=(${comp}*) ;;
	d|t|x)
		if [[ "$file" == "-" ]]; then
			reply=(${comp}*)
		else
			if [[ $file == (|.)*.(gz|tgz|z|taz|Z|taZ) ]]; then zopt=z; fi
			list=(`tar t${zopt}f $file`)
			reply=()
			for elem in $list; do
				if [[ $elem == ${comp}* ]]; then reply=($reply $elem); fi
			done
		fi
esac
---CUT HERE---

-- 
... that whenever any form of government becomes destructive of these
ends, it is the right of the people to alter or to abolish it, and to
institute new government, laying its foundation on such principles,
and organizing its powers in such form, as to them shall seem most
likely to effect their safety and happiness.
    -- Thomas Jefferson, Prologue, "Declaration of Independence"

{ Chris "Xris" Laas }----{ chrisl@cybercom.net }----{ xris@qfl.com }

------- End of Forwarded Message


^ permalink raw reply	[flat|nested] 2+ messages in thread

* (off-topic) Re: forwarding to the list.
  1997-01-04 11:30 forwarding to the list Richard Coleman
@ 1997-01-04 11:39 ` Daniel Reish
  0 siblings, 0 replies; 2+ messages in thread
From: Daniel Reish @ 1997-01-04 11:39 UTC (permalink / raw)
  To: Richard Coleman; +Cc: zsh-workers

On Sat, 4 Jan 1997, Richard Coleman wrote:

> I think the mailing list manager thought this was
> a subscription request, so I don't think it got
> through.  So I'm forwarding it to the list.

More likely, it won't pass through mail sent by root.  There seems to be
an increasing effort by authors of mail software to clamp down on this
sort of behavior.  (Qmail, for example, refuses to deliver any mail to a
root mailbox, though I suspect this is for security reasons.)

--
Dan


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~1997-01-04 11:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-01-04 11:30 forwarding to the list Richard Coleman
1997-01-04 11:39 ` (off-topic) " Daniel Reish

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).