From ataylor@its.to  Mon Jan  5 14:06:13 2004
Return-Path: <ataylor@its.to>
X-Original-To: ianmacd@jiskefet.caliban.org
Delivered-To: ianmacd@jiskefet.caliban.org
Received: from caliban.org (caliban.org [69.17.45.226])
	by jiskefet.caliban.org (Postfix) with ESMTP id 9E08E2DC003
	for <ianmacd@jiskefet.caliban.org>; Mon,  5 Jan 2004 14:06:13 -0800 (PST)
Received: by caliban.org (Postfix)
	id 6E1B01DE4CE; Mon,  5 Jan 2004 14:06:58 -0800 (PST)
Delivered-To: ianmacd@caliban.org
Received: from phyrewall.local.bogus (h68-147-119-234.cg.shawcable.net [68.147.119.234])
	by caliban.org (Postfix) with ESMTP id 14FFF1DE4CD
	for <ian@caliban.org>; Mon,  5 Jan 2004 14:06:58 -0800 (PST)
Received: from its.to (localhost.localdomain [127.0.0.1])
	by phyrewall.local.bogus (8.12.10/8.12.10) with ESMTP id i05LxxXM015395
	for <ian@caliban.org>; Mon, 5 Jan 2004 14:59:59 -0700
Message-ID: <3FF9DFDE.7080907@its.to>
Date: Mon, 05 Jan 2004 15:06:22 -0700
From: Andrew Taylor <ataylor@its.to>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.6b) Gecko/20031208
X-Accept-Language: en-us, en
MIME-Version: 1.0
To: ian@caliban.org
Subject: Bash Completions
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Checker-Version: SpamAssassin 2.61 (1.212.2.1-2003-12-09-exp) on 
	jiskefet.caliban.org
X-Spam-Level: 
X-Spam-Status: No, hits=-2.2 required=6.5 tests=BAYES_00,RCVD_IN_DYNABLOCK,
	RCVD_IN_SORBS autolearn=no version=2.61
Status: RO
Content-Length: 1119
Lines: 41

Hi Ian.  I'm a big fan of your bash completions project, and I've 
rewritten some rules for completing the "dd(1)" program.  Here is what I 
came up with, please feel free to integrate this into bash_completions.

I haven't been able to figure out how to get it to append a space after 
full options, but not partial options like "if=".


_dd()
{
         local cur

         COMPREPLY=()
         cur=${COMP_WORDS[COMP_CWORD]}

         case "$cur" in
         if=*|of=*)
                 cur=${cur#*=}
                 _filedir
                 return 0
                 ;;
         conv=*)
                 cur=${cur#*=}
                 COMPREPLY=( $( compgen -W 'ascii ebcdic ibm block unblock \
                                lcase notrunc ucase swab noerror sync' \
                                -- $cur ) )
                 return 0
                 ;;
         esac

         _expand || return 0

         COMPREPLY=( $( compgen -W '--help --version' -- $cur ) \
                     $( compgen -W 'bs cbs conv count ibs if obs of seek 
skip' -S '=' -- $cur ) )
}
complete -o nospace -F _dd dd


-- 
Andrew

