/mimeopen

mimeopen is an utility for opening files based on its mime type

Primary LanguageTclBSD 2-Clause "Simplified" LicenseBSD-2-Clause

NAME
====

mimeopen - open files with a program specific to its mime type


SYNOPSIS
========

mimeopen [OPTIONS] FILE_NAME ...


DESCRIPTION
===========

mimeopen is an utility for opening files with a program specific to its mime
type(based on mailcap files).  It use a mailcap file(rfc1524) to detect a
right command line for an each file.

Locations for mailcap files can be specified with MAILCAPS environment variable.
MAILCAPS contain pathes separated by colon(like in PATH variable). If there is
no MAILCAPS variable in an environment, then by default it value is:

$HOME/.mailcap:/etc/mailcap:/usr/share/etc/mailcap:/usr/local/etc/mailcap

Options:
  -s, --separate
               open each file separately
  -f, --foreground
               open files in the foreground
  -F, --no-filter
               do not filter some mailcap entries(*/*)
  -d, --debug  output debug info
  --dry-run    output view command without executing
  -v, --version
               output a version
  -h, --help   output this help


DEPENDENCIES
============

mimeopen use:
- file program(to detect a mime type of specified files).
- getopt package(https://github.com/lego12239/getopt.tcl).
- simpleconf package(https://github.com/lego12239/simpleconf.tcl).


SETUP
=====

Change the line(at the top of the mimeopen source) with auto_path variable
modification to reflect getopt and simpleconf packages location and then:
cp mimeopen ~/bin/
ln -s ~/bin/mimeopen ~/bin/open


CONF FILE
=========

mimeopen read, if exists, ~/.mimeopen.conf file to get some configuration.
This file can contain:

- term_cmd
  A command to run a terminal("xterm -e" by default)
- shell_cmd
  A shell command to run open command("sh -c" by default)


MAILCAP
=======

Extenstions:

- %S:
  Like %s, but allow many files to be substituted(instead of one like for %s)
  separated with spaces. %S should be used without surrounding quotes.