# Advanced Usage

## Command Line Options

When running &appname; from the command line, there are several options for opening data files. They may be seen by running `tellico --help`.

    Usage: tellico [Qt-options] [KDE-options] [options] [filename]

    Tellico - a collection manager for KDE

    Options:
      --nofile                  Do not reopen the last open file
      --bibtex                  Import <filename> as a bibtex file
      --mods                    Import <filename> as a MODS file
      --ris                     Import <filename> as a RIS file

    Arguments:
      filename                  File to open

## &DCOP; Interface

&appname; has a minimal &DCOP; interface, which can be used for scripting or interacting with a running application from the command-line. As with all &DCOP; calls, you need to specify the application you want to interface with, and the particular interface. The &DCOP; calls described in this document are all implemented in &appname;'s `tellico` interface, while the name of the application is `tellico-pid`, where pid is the process id of the running application.

### DCOP Commands

The full list of &DCOP; commands in the `tellico` object is shown below:

    bool importTellico(QString file, QString action)
    bool importBibtex(QString file, QString action)
    bool importMODS(QString file, QString action)
    bool importRIS(QString file, QString action)
    bool exportXML(QString file)
    bool exportBibtex(QString file)
    bool exportHTML(QString file)
    bool exportCSV(QString file)
    bool exportPilotDB(QString file)
    QStringList bibtexKeys()

For the four import commands, the first argument is the file to import, and the second is the import action. Three actions are available: replace, append, and merge. Four file formats are supported for importing: Tellico XML files, Bibtex files, MODS files, and RIS files.

The current open collection in &appname; may be exported to a file, in either Tellico XML format, Bibtex, HTML, or comma-separated values (CSV) format.

Finally, if the current collection is a bibliography, calling `bibtexKeys()` will return the Bibtex citation key for all selected entries.

### DCOP Examples

Here are some examples for scripting &appname; using the &DCOP; interface. Since the pid must be known, the easiest way to include that in the shell command is like so: `dcop $(dcop | grep tellico) tellico`.

    Open a Bibtex file
    % dcop $(dcop | grep tellico) tellico importBibtex ~/documents/reference.bib replace
    true

    Export a Bibtex file
    % dcop $(dcop | grep tellico) tellico exportBibtex ~/documents/reference.bib
    true

    Echo the citation key of the current selection
    % dcop $(dcop | grep tellico) tellico bibtexKeys
    stephenson2004