]> git.phdru.name Git - mimedecode.git/blobdiff - mimedecode.docbook
CI(Travis): Set default OS to `linux`, dist to `xenial`
[mimedecode.git] / mimedecode.docbook
index 7d767f3cff55fe7eb7030c46e5952bca3c068724..29d081d84993ff38e5a618d659545b7b6cd8890e 100644 (file)
@@ -2,10 +2,10 @@
 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
   "file:///usr/share/xml/docbook/schema/dtd/4.5/docbookx.dtd">
 
-<refentry id="mimedecode.py">
+<refentry id="mimedecode">
 
 <refentryinfo>
-  <title>mimedecode.py</title>
+  <title>mimedecode</title>
   <productname>mimedecode.docbook</productname>
   <author>
     <firstname>Oleg</firstname>
     <personblurb/>
   </author>
   <copyright>
-    <year>2001-2014</year>
+    <year>2001-2018</year>
     <holder>PhiloSoft Design.</holder>
   </copyright>
 </refentryinfo>
 
 <refmeta>
-   <refentrytitle>mimedecode.py</refentrytitle>
+   <refentrytitle>mimedecode</refentrytitle>
    <manvolnum>1</manvolnum>
 </refmeta>
 
 <refnamediv>
-   <refname>mimedecode.py</refname>
+   <refname>mimedecode</refname>
    <refpurpose>decode MIME message</refpurpose>
 </refnamediv>
 
 <refsynopsisdiv>
    <cmdsynopsis>
-      <command>mimedecode.py</command>
+      <command>mimedecode</command>
       <arg choice="opt">
          <option>-h|--help</option>
       </arg>
@@ -90,7 +90,7 @@
          <option>--set-param header:param=value</option>
       </arg>
       <arg choice="opt">
-         <option>-Bbeit mask</option>
+         <option>-BbeIit mask</option>
       </arg>
       <arg choice="opt">
          <option>--save-headers|body|message mask</option>
 </para>
 
 <para>
-   Here is a solution - mimedecode.py!
+   Here is a solution - mimedecode!
 </para>
 
 <para>
    to find a way to convert the body to plain text (can be prevented with
    options -Bbei). (The author has no idea how mailcap can be configured on
    OSes other than POSIX, please don't ask; users can consult an example at
-   <ulink url="http://phdru.name/Software/dotfiles/mailcap.html">http://phdru.name/Software/dotfiles/mailcap.html</ulink>).
+   <ulink url="https://phdru.name/Software/dotfiles/mailcap.html">https://phdru.name/Software/dotfiles/mailcap.html</ulink>).
    The decoding process uses the first copiousoutput filter it can find. If
    there are no filters the body just passed as is.
 </para>
       <term>-p header1[,header2,header3,...]:param1[,param2,param3,...]</term>
       <listitem>
          <para>
-            Add the parameters(s) to a list of headers parameters to decode;
-            the parameters will be decoded only for the given header(s).
+            Add the parameter(s) to a list of headers parameters to decode;
+            the parameter(s) will be decoded only for the given header(s).
             Initially the list contains header "Content-Type", parameter "name";
             and header "Content-Disposition", parameter "filename".
          </para>
       <term>-p *[,-header1,-header2,-header3,...]:param1[,param2,param3,...]</term>
       <listitem>
          <para>
-            Add the parameters(s) to a list of headers parameters to decode;
-            the parameters will be decoded for all headers except the given
+            Add the parameter(s) to a list of headers parameters to decode;
+            the parameter(s) will be decoded for all headers except the given
             ones.
          </para>
       </listitem>
       <term>-R header1[,header2,header3,...]:param1[,param2,param3,...]</term>
       <listitem>
          <para>
-            Add the parameters(s) to a list of headers parameters to remove;
-            the parameters will be removed only for the given header(s).
+            Add the parameter(s) to a list of headers parameters to remove;
+            the parameter(s) will be removed only for the given header(s).
             Initially the list is empty.
          </para>
       </listitem>
       <term>-R *[,-header1,-header2,-header3,...]:*[,-param1,-param2,-param3,...]</term>
       <listitem>
          <para>
-           Remove listed parameters (or all parameters except listed) frome
+           Remove listed parameters (or all parameters except listed) from
            these headers (or from all headers except listed).
          </para>
       </listitem>
       </listitem>
    </varlistentry>
 
+   <varlistentry>
+      <term>-I mask</term>
+      <listitem>
+         <para>
+            Append mask to the list of content types to completely ignore.
+            There will be no output - no headers, no body, no warning. For a
+            multipart part the entire subtree is removed.
+         </para>
+      </listitem>
+   </varlistentry>
+
    <varlistentry>
       <term>-i mask</term>
       <listitem>
          <para>
             Save output to the file related to the destination directory from
             option -O. Also useful in case of redirected stdin:
-            <programlisting language="sh">mimedecode.py -o output_file &lt; input_file
-cat input_file | mimedecode.py -o output_file</programlisting>
+            <programlisting language="sh">mimedecode -o output_file &lt; input_file
+cat input_file | mimedecode -o output_file</programlisting>
          </para>
       </listitem>
    </varlistentry>
@@ -501,7 +512,7 @@ cat input_file | mimedecode.py -o output_file</programlisting>
 
 <para>
 <code language="sh">
-  mimedecode.py -t application/pdf -t application/postscript -t text/plain
+  mimedecode -t application/pdf -t application/postscript -t text/plain
       -b text/html -B 'image/*' -i '*/*'
 </code>
 </para>
@@ -520,6 +531,12 @@ cat input_file | mimedecode.py -o output_file</programlisting>
    earlier than -B */*.
 </para>
 
+<para>
+  Options -e/-I/-i can also work with multipart subparts of a MIME message. In
+  case of -I/-i the entire subtree of that multipart is removed; with -i it's
+  replaced with ignore warning.
+</para>
+
 <para>
    Initially all 5 lists are empty, so without any additional parameters
    the program always uses the default decoding (as -t */*).
@@ -536,9 +553,21 @@ cat input_file | mimedecode.py -o output_file</programlisting>
   counter is prepended to the filename to avoid collisions; if there are no
   name/filename parameters, or the name/filename parameters contain forbidden
   characters (null, slash, backslash) the filename is just the serial counter.
+</para>
+
+<para>
+  If the file doesn't have any extensions (no dots in the value of the
+  name/filename parameters, or the name is just the counter) the program tries
+  to guess an extension by looking up the content type in mime.types files
+  including .mime.types file in the user's home directory (if it exists). If
+  the file has an extension the program doesn't try to verify that it
+  corresponds to the content type.
+</para>
+
+<para>
   The file is saved in the directory set with -O (default is the current
-  directory). The save options are processed before option -e so the user can
-  save the message that causes the error.
+  directory). The save options are proceeded before -e options so the user can
+  save the message that causes an error.
 </para>
 </refsect1>
 
@@ -585,7 +614,7 @@ cat input_file | mimedecode.py -o output_file</programlisting>
 <refsect1>
 <title>COPYRIGHT</title>
 <para>
-  Copyright (C) 2001-2014 PhiloSoft Design.
+  Copyright (C) 2001-2018 PhiloSoft Design.
 </para>
 </refsect1>
 
@@ -612,8 +641,8 @@ cat input_file | mimedecode.py -o output_file</programlisting>
 <refsect1>
 <title>SEE ALSO</title>
 <para>
-  mimedecode.py home page:
-  <ulink url="http://phdru.name/Software/Python/#mimedecode">http://phdru.name/Software/Python/#mimedecode</ulink>
+  mimedecode home page:
+  <ulink url="https://phdru.name/Software/Python/#mimedecode">https://phdru.name/Software/Python/#mimedecode</ulink>
 </para>
 </refsect1>