bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: diff: [ENHANCEMENT] add option to support compressed files: -z, --co


From: Jari Aalto
Subject: Re: diff: [ENHANCEMENT] add option to support compressed files: -z, --compress
Date: Sat, 08 Aug 2009 20:33:27 +0300
User-agent: Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.91 (gnu/linux)

Bob Proulx <address@hidden> writes:

> Jari Aalto wrote:
>
>> Please add new option -z, --compress to support compressed files.
>

May I suggest that -z would be generic "do the right thing". Sompressors
could be built in during compile according to libs available.

    diff -z orig/file.c.lzop  file.c.lzop       # same .EXT
    diff -z orig/file.c.lzop  file.c.gz         # Different .EXT
    diff -z orig/file.c.lzop  file.c            # only one compressed .EXT

> It would be better if this were a generically usable interface to a
> variety of compressors such as gzip, bzip2, lzop, lzma, etc.

That would be welcomed. Something like

  --use-compress-program=...

It should allow list (separated by colon ":" marker) of file extensions
and their respective compressor commands. Here .EXT is is file
extension. CMD would be any external program with options accepting
stdin and writing to stdout.

    ".EXT COMMAND:[.EXT COMMAND]..."

>>    cd /usr/src/versin-control/program.cvs
>>    diff -u -z program.1  /usr/share/man/man1/program.1.gz
>
> Note that modern shells including GNU bash allow this through the
> command line shell.
>
>   diff -u program.1 <(zcat /usr/share/man/man1/program.1.gz)
>
> Is that good enough?  If it is in the shell and therefore supports all
> compressors and all command line utilities uniformly then I do not
> think that it should be added to the code of every command line
> program.

Unfortunately /bin/sh does not always allow <(CMD). The -z option would be
quite convenient.

Jari





reply via email to

[Prev in Thread] Current Thread [Next in Thread]