Next: , Previous: Plotting data, Up: Top   [Contents]


8 Writing scripts

The mu program has built-in support for running guile-scripts, and comes with a number of examples.

You can get a list of all scripts with the mu script command:

$ mu script
Available scripts (use --verbose for details):
  * find-dups: find duplicate messages
  * msgs-count: count the number of messages matching some query
  * msgs-per-day: graph the number of messages per day
  * msgs-per-hour: graph the number of messages per hour
  * msgs-per-month: graph the number of messages per month
  * msgs-per-year: graph the number of messages per year
  * msgs-per-year-month: graph the number of messages per year-month

You can then execute such a script by its name:

$ mu msgs-per-month --textonly --query=hello


                        Messages per month matching hello

  240 ++-+-----+----+-----+-----+-----+----+-----+-----+-----+----+-----+-++
      |  +     +    +     + "/tmp/filewi9H0N" using 2:xticlabels(1) ****** |
  220 ++                                       *    *                 ******
      |                                        *    *                 *    *
  200 ++                                       *    *                 *   +*
      |                                        *    *                 *    *
  180 ++                     ******            *    *                 *   +*
      |                      *    *            *    *                 *    *
  160 ******                 *    *            *    *                 *   +*
      *    *                 *    *            *    *                 *    *
      *    *******           *    *            *    *     ******      *    *
  140 *+   **    *           *    *            *    *     *    ********   +*
      *    **    *******     *    *            *    *     *    **    **    *
  120 *+   **    **    *******    *            *    *     *    **    **   +*
      *    **    **    **    *    *            *    *******    **    **    *
  100 *+   **    **    **    *    *            *    *    **    **    **   +*
      *  + **  + ** +  ** +  *  + *   +    +   * +  *  + **  + ** +  ** +  *
   80 **********************************************************************
        Jan   Feb  Mar   Apr   May   Jun  Jul   Aug   Sep   Oct  Nov   Dec
                                      Month

Please refer to the mu-script man-page for some details on writing your own scripts.