This is an idea for an /etc/mailcap entry for "cat". This allows a text
file to be catted with
run-mailcap --action=cat foo.txt
The file below is debian/coreutils.mime and adding dh_installmime to the
binary-arch should install it to /usr/lib/mime/packages/coreutils.
I'm not sure why this would be useful. Why wouldn't you just pipe the file to a pager and avoid the mailcap indirection? I'd think this would be more likely to confuse people with control character output when they're expecting an image or somesuch. Mike Stone
Michael Stone <mstone@debian.org> writes: Currently "run-mailcap --action=cat" cannot cat a text/plain text file but adding a mailcap entry will let it work. Primarily for genericness. If you have a mail part or file then you let run-mailcap find a good command. But --action=cat is not for a pager, rather getting plain text to pass on somewhere else. For text/plain this is a no-op, but that knowledge is not built-in to run-mailcap, hence a "cat" entry. (Not hard-coding it seems reasonable to me. Let the runner be general and add entries expressing what various programs like "cat" can or will do. Other programs might make use of those entries too.) Oh, images or other binaries are meant to be crunched by the mailcap rules to plain text for this --action=cat, or at least that's the idea. For example xlhtml can crunch an application/excel to text (via html in its case). Or "tar" and 'unzip" offer a contents listing for tar and zip files.
Kevin Ryde wrote: I don't understand how mailcap and mime types are related to coreutils. I don't think coreutils should own a mailcap entry. What mail-user-agent are you using where this configuration is advantageous? I have used many MUAs over the years and this hasn't ever been needed. Therefore I am skeptical of the proposal. I can certainly use my MUA to perform actions on various sorts of text/* attachments without this mailcap entry. I am therefore suspicious that this should actually be a wishlist enhancment request against your MUA. What specific action are you trying to do with what mailer that currently isn't working for you? The run-mailcap command is in the mime-support package. Perhaps this issue would be better discussed within the mime-support package project rather than about coreutils? It doesn't seem to me to be a coreutils issue. The text/plain mailcap is already loaded with other entries such as on my system: text/plain; less '%s'; needsterminal text/plain; most '%s'; needsterminal text/plain; more '%s'; needsterminal text/plain; emacs23 %s; test=test -n "$DISPLAY" text/plain; emacs24 %s; test=test -n "$DISPLAY" text/plain; gedit --new-document %s; test=test -n "$DISPLAY" text/plain; gobby-0.5 %s; test=test -n "$DISPLAY" text/plain; gvim -f %s; test=test -n "$DISPLAY" text/plain; leafpad %s; test=test -n "$DISPLAY" text/plain; xfview %s; test=test -n "$DISPLAY" text/plain; xfwrite %s; test=test -n "$DISPLAY" text/plain; view '%s'; edit=vim '%s'; compose=vim '%s'; test=test -x /usr/bin/vim; needsterminal text/plain; gview -f '%s'; edit=gvim -f '%s'; compose=gvim -f '%s'; test=test "$DISPLAY" != "" text/plain; view '%s'; edit=vi '%s'; compose=vi '%s'; needsterminal Those all seem more appropriate than 'cat'. And more specifically 'cat' is not a display program. It really should be handled by a pager such as more, less or most. (And those already exist.) Or at least a program that is designed to be a display program. I think this is definitely beyond the scope of the coreutils package. Bob
Bob Proulx <bob@proulx.com> writes: It was to make "run-mailcap --action=cat" work on text/plain. Notice they're all either needsterminal or $DISPLAY, whereas the "cat" program is a copiousoutput. Perhaps, though it seemed to me reasonably clear the cat program could be sensibly given an entry of the kind described in fact already in the mailcap(5) man page. mime-support generates a few things of its own making, but mainly leaves entries to the package containing the program.
Kevin Ryde wrote: A response that completely avoided answering my question. The 'cat' program is for concatenating files. It isn't a text display program and should not be used as such. Especially not as a system default configuration. (Nor should cat be used to write device drivers in machine code even if one is inclined to do so.) Bob