Working principles | Index | pdr Configuration

## pdr Invocation

pdr accepts options and arguments.
Note: Options can have arguments themselves. Don't mix this.
Options start with a minus character. A second minus indicates long options with readable names. All available options and arguments can be listed by pdr -? or pdr --help.

### Abbreviated interactive invication

If the program is started by a symbolic link with the name pdri this is exactly the same as pdr -i (see below).

### Options

-? | show a help screen
-V | show the pdr version
-v | show what is being done, without this option, pdr shows only errors
-c filename | use filename as configuration file, this option superseedes the standard configuration file ~/.pdrxrc
-l | list all known collections in the database and some statistics
-a "name[, type[, unit[, purpose]]]" | add a collection to the database, the argument is a string, containing name and type of the new collection, types are n, r and t (for numeric, ratio or text), optional you can specify a unit and a verbose description of the collection
-d name | delete a collection, the argument is the name of the collection
-D | delete all collections, the collections * and # are not deleted but will be cleared completely
-r | list all known rejections
-R | delete all current rejections
-e "expr" | evaluate an expression, the argument should be a complete expression
-t filename | import a text file into the database
-C filename | import a CSV file into the database
-x filename | import a XML file into the database
-n | do not use any of the configured datasources, use the command line only
-i | start pdr in interactive mode
-X filename | export the contents of the entire database into a XML file, this file is compatible to the one used by -x
--create-config | create an initial default configuration at ~/.config/pdrx Note: the created file pdrxrc is not ready to use, the user has at least to configure his database and probably a mail server
--browser executable (not on Windows) | specify executable as the browser to invoke if Twitter authentication is made, this executable must contain a path if needed
--debug | show debug information in case of a malfunction

### Arguments

Everything that follows the program name pdr on the command line and does not begin with a minus counts as argument of pdr. All arguments are summed up to one expression and are evaluated as one:
$ pdr 5.2 5n 8l -v \; this is comment up to the end of the line
The resulting expression built from arguments is:
5.2 5n 8l ; this is comment up to the end of the line
-v does not belong to the resulting expression, it's a known option of pdr. The backslash in front of the semicolon is special for Unix-like operating systems. Their shell evaluates the semicolon itself but we use it as comment delimiter. To avoid a conflict we must put a backslash there. This backslash will be removed by the shell and will truely not get into the input of pdr.

### Examples

First the options for handling collections. -l or --list-collections shows all known collections and some statistic data:
$ pdr -l
name type table recs first last purpose
# text C1 160 2008-11-25 18:45:00 2010-01-02 21:55:37 comments
* numeric C0 1636 2008-11-25 05:00:00 2010-01-03 12:10:00 blood sugar
h numeric C6 1 2009-05-19 16:00:00 2009-05-19 16:00:00 HbA1c
l numeric C3 707 2008-11-25 05:00:00 2010-01-03 06:26:01 base insuline
m numeric C4 612 2009-03-04 05:00:00 2010-01-03 06:26:01 tablets
n numeric C2 1275 2008-11-25 05:00:00 2010-01-03 12:10:00 bolus insuline
x numeric C5 119 2009-03-22 09:28:09 2010-01-03 10:31:01 experiments
This table shows name and type of every collection, the physical SQL table in the database, the number of records and the first and last timestamps. At the end of each line the purpose of the collections is shown if defined.
You can add a collection using -a or --add-collection:
$ pdr -a "k,n"
$ pdr -l
name type table recs first last purpose
# text C1 160 2008-11-25 18:45:00 2010-01-02 21:55:37 comments
* numeric C0 1636 2008-11-25 05:00:00 2010-01-03 12:10:00 blood sugar
h numeric C6 1 2009-05-19 16:00:00 2009-05-19 16:00:00 HbA1c
k numeric C7 0
l numeric C3 707 2008-11-25 05:00:00 2010-01-03 06:26:01 base insuline
m numeric C4 612 2009-03-04 05:00:00 2010-01-03 06:26:01 tablets
n numeric C2 1275 2008-11-25 05:00:00 2010-01-03 12:10:00 bolus insuline
x numeric C5 119 2009-03-22 09:28:09 2010-01-03 10:31:01 experiments
The argument contains the name of the new collection, a comma and then the type written as n (for numeric), r (for ratio) or t (for text).
A collection that is not needed anymore can be deleted using -d or --delete-collection:
$ pdr -d k
You can delete all collections at once with -D or --delete-all-collections. After this you will still have two remaining, empty collections, * and #:
$ pdr -D
$ pdr -l
name type table recs first last purpose
# text C1 0 comments
* numeric C0 0 blood sugar
There are two options for handling rejections. Using -r or --list-rejections rejected data can be listed:
$ pdr -r
timestamp expression
2010-01-03 17:46:20 12.0k (error here: the collection k doesn't exist)
If you have rejections you should check the rejected expressions. If you can "guess" the correct expression, if you can remember, you can enter a correct expression on the command line. After correcting all the rejections you can delete them all at once:
$ pdr -R
The option -e or --expression allows the specification of exactly one expression for input:
$ pdr -e "5.2" -e "2009-12-31 17:28:03 7.9"
This option can be used multiply. Then these expressions remain independent.
The option -n or --none allows the abandonment of all configured data sources. This is useful in the case of multiple command line invocations in a short time, for instance for executing expressions. Many mail servers don't want you to login many times in a short time. Oftenly this is limited to a concrete number per minute. Getting an email connection also costs time. Using -n you work very privately on your local database.

Working principles | Index | pdr Configuration