Changes

Jump to: navigation, search

Gramps 3.1 Wiki Manual - Command Line

2,233 bytes added, 08:25, 31 December 2010
m
Protected "Gramps 3.1 Wiki Manual - Command Line" ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite))
{{grampsmanualcopyright}}
{{man index|Gramps 3.1 Wiki Manual - Keybindings|Gramps 3.1 Wiki Manual - About|3.1}}
{{languages|Gramps_3.1_Wiki_Manual_-_Command_Line}}
== Available options ==
This section provides the reference list of all command line options available in GRAMPS. If you want to know more than just a list of options, see next sections: [[Gramps-command line#Operation|Operation]] and [[Gramps-command line#Examples| Examples]].A list is also available on [[Plugins_Command_Line|this page]].  === List option === -l, print a list of known family trees-L, print a detailed list of known family trees 
=== Format options ===
The format of any file destined for opening, importing, or exporting can be specified with the <pre>-f format</pre> option. The acceptable <tt>''format''</tt> values are listed below.
 ==== Full family tree support ====These formats contain all your data that is present in a family tree.  *grdb '''gramps''' - GRAMPS databaseXML format: This format is available for opening, import, and export. When not specified, it can be guessed if the filename ends with .grdbgramps*gramps'''gpkg''' -xml GRAMPS package XML databaseformat: This format is available for opening, import, and export. When not specified, it can be guessed if the filename ends with .grampsgpkg. This creates a zip package with your data as xml, and all your media files included*gedcom GEDCOM file'''grdb''' - pre GRAMPS 3.x database: This format is available for opening, import, and exportto support the old file format of GRAMPS. Everything in the grdb file is imported. When not specified, it can be guessed if the filename ends with .gedgrdb*gramps'''burn''' -pkg GNOME iso burning: export, only available on GNOME where burn protocol exists ==== Reduced family tree support ====These formats contain most, but not all data that can be created in GRAMPS package *'''ged''' - GEDCOM format: This format is available for import , and export. When not specified, it can be guessed if the filename ends with .gpkgged*geneweb '''gw''' - GeneWeb file: This format is available for import and export. When not specified, it can be guessed if the filename ends with .gw ==== Subset of your data ====These formats contain a specific subset of your data *'''csv''' - Comma Seperated Value: This format is available for import and export. Be carefull however, import must be as values created by the export function. Only a part of your data is contained in the output.* '''vcf''' - VCard format: import and export* '''vcs''' - VCalander format: export* '''def''' - old Pro-Gen format: import* '''wft ''' - Web Family Tree: This format is available for export only. When not specified, it can be guessed if the filename ends with .wft*iso CD image: This format is available for export only. It must always be specified explicitly.
=== Opening options ===
There are two ways to give You can open a family tree, or you can ''open'' a file by importing it in an empty family treeTo let GRAMPS handle this automatically, just supply the name of the file familytree or filename you want to be openedopen:
* supply bare file python gramps.py 'My Fam Tree' python gramps.py JohnDoe.ged The first opens a family tree, the second imports a gedcom into an empty family tree.  Additionally, you can pass GRAMPS the nameof the family tree to be opened: * use this option : <pre>-O filenamefamtree</pre> or <pre>--open=filename famtree </pre>
-O, Open of a family tree. This can be done also by just typing the name (name or database dir)
python gramps.py -O /home/cristina/.gramps/grampsdb/47320f3d
If the filename is given without any option flag, the attempt to open the file will be made, and then the interactive GRAMPS session will be launched.
 
{{Man tip| Tip |If no option is given, just the file name, GRAMPS will ignore the rest of the command line arguments. Use the -O flag to open the file and do something with the data.}}
The format can be specified with the <pre>-f format</pre> or <pre>--format=format</pre> {{Man tip| Tip |If no optionis given, immediately following the ''filename'' . If not specifiedjust a name, GRAMPS will ignore the guess will be attempted based on rest of the ''filename''command line arguments. Format possible: 'gedcom','grampsUse the -xml'O flag to open,'gramps-pkg'i to import, 'grdb','geneweb'and do something with the data.}}
{{Man tip| Tip |Only grdb, gramps-xml, and gedcom formats family trees can be opened directly. For other formats, you will need to use the import option which will set up the empty database and then import data into it.}}
{{Man tip| Tip |Only a single file family tree can be opened. If you need to combine data from several sources, you will need to use the import option.}}
=== Import options ===
=== Export options ===
The files destined for export can be specified with the <pre>-o e filename</pre> or <pre>--outputexport=filename</pre> option. The format can be specified with the <pre>-f</pre> option immediately following the ''filename'' . If not specified, the guess will be attempted based on the ''filename'' . For iso format, the ''filename'' is actually the name of directory the GRAMPS database will be written into. For grdb, gramps-xml, gpkg, gedcom, wft, geneweb, and gramps-pkg, the ''filename'' is the name of the resulting file.
-oe, output export a family tree in required format. It is not possible to export to a family tree.
Example:
python gramps.py -i 'Family Tree 1' -i test.grdb -f grdb -o e mergdeDB.gramps
Note that above does not change 'Family Tree 1' as everything happens via a temporary database, whereas:
python gramps.py -O 'Family Tree 1' -i test.grdb -f grdb -o e mergdeDB.gramps
will import test.grdb into Family Tree 1, and then export to a file !
{{man tip| Exporting more files |More than one file can be exported in one command. If this is the case, GRAMPS will attempt to write several files using the data from the database available at the moment.}}
When more than one output file is given, each has to be preceded by <pre>-oe</pre> flag. The files are written one by one, in the specified order.
=== Action options ===
Currently available actions are:
*''summary'': This action is the same as ''' Reports ->View ->Summary '''. Note: will be removed in 3.2, use '''-a tool -p name=summary''' instead.
*''check'': This action is the same as ''' Tools ->Database Processing ->Check and Repair ''' . Note: will be removed in 3.2, use '''-a report -p name=check''' instead.
*''tool'': This action allow to run a tool from a command line.
*''report'': This action allows producing reports from the command line. As reports generally have many options of their own, this action should be followed by the report option string. The string is given using the <pre>-p option_string</pre> or <pre>--options=option_string</pre> option.
 
==== report action option ====
You can some reports from the command line using the report action.
An example:
gramps -O "Family Tree 1" -a report -p "name=family_group,style=default,off=html,of=test.html"
 
In version 3.2, you can provide the css style to use here with the css option:
gramps -O "Family Tree 1" -a report -p "name=family_group,style=default,off=html,of=test.html,css=Web_Nebraska.css"
or without css in the html output:
gramps -O "Family Tree 1" -a report -p "name=family_group,style=default,off=html,of=test.html,css="
{{man tip| Report option string |The report option string should satisfy the following conditions:It must not contain any spaces. If some arguments need to include spaces, the string should be enclosed with quotation marks.
*name=report_name: This mandatory option determines which report will be generated. If the supplied report_name does not correspond to any available report, the error message will be printed followed by the list of available reports.
*of : output filename*off: output format. These are the extension an output format makes available, eg, pdf, html, doc, ...*style: for text reports, the stylesheet to use. Defaults to 'default'
*show=all: This will produce the list of names for all options available for a given report.
 
*show=option_name: This will print the description of the functionality supplied by the option_name, as well as what are the acceptable types and values for this option.
Use the above options So, to find out everything about learn to use a report, do for example: gramps -O "Family Tree 1" -a given report.-p "name=family_group,show=all"
{{man tip| Tip |If an option is not supplied, the last used value will be used. If this report has never been generated before, then the value from last generated report will be used when applicable. Otherwise, the default value will be used.}}
When more than one output action is given, each has to be preceded by <pre>-a</pre> flag. The actions are performed one by one, in the specified order.
=== List force unlock option === -u, you can extent the -O flag with -u to force a locked family to be unlocked. This allows to recover from a crash that leaves the famlily tree locked from the command line.
-l, print a list of known Note that it is not possible to open family treesthat need repair from the command line
== Operation ==
{{man note|1=Note |2=Only one file can be opened in a single invocation of GRAMPS. If you need to get data from multiple sources, use the importing options by using <pre>-i</pre> flag.}}
With or without the <pre>-O</pre> flag, there could be multiple imports, exports, and actions specified further on the command line by using <pre>-i</pre> , <pre>-oe</pre> , and <pre>-a</pre> flags.
The order of <pre>-i</pre> , <pre>-oe</pre> , or <pre>-a</pre> options with respect to each does not matter. The actual execution order always is: all imports (if any) -> all exports (if any) -> all actions (if any).
'{{man note| Note |But opening must always be first!}}
If no <pre>-O</pre> or <pre>-i</pre> option is given, GRAMPS will launch its main window and start the usual interactive session with the empty database, since there is no data to process, anyway.
If no <pre>-oe</pre> or <pre>-a</pre> options are given, GRAMPS will launch its main window and start the usual interactive session with the database resulted from opening and all imports (if any). This database resides in the ''import_db.grdb'' file under the ''~/.gramps/import/'' directory.
Any errors encountered during import, export, or action, will be either dumped to stdout (if these are exceptions handled by GRAMPS) or to stderr (if these are not handled). Use usual shell redirections of stdout and stderr to save messages and errors in files.
:<pre>gramps -i file1.ged -f gedcom -i file2.gpkg -f gramps-pkg -i ~/db3.gramps -f gramps-xml -i file4.wft -f wft -a check</pre>
*To record the database resulting from all imports, supply -o e flag (use -f if the filename does not allow GRAMPS to guess the format):
:<pre>gramps -i file1.ged -i file2.gpkg -o e ~/new-package -f gramps-pkg</pre>
*To save any error messages of the above example into files outfile and errfile, run:
:<pre>gramps -i file1.ged -i file2.dpkg -o e ~/new-package -f gramps-pkg >outfile 2>errfile </pre>
*To import three databases and start interactive GRAMPS session with the result:
*To open a database and, based on that data, generate timeline report in PDF format putting the output into the my_timeline.pdf file:
:<pre>gramps -O file.grdb 'Family Tree 1' -a report -p name=timeline,off=pdf,of=my_timeline.pdf </pre>
{{man tip|1=Timeline report options |2=Use the <tt>''name=timeline,show=all''</tt> to find out about all available options for the timeline report. To find out details of a particular option, use <tt>''show=option_name''</tt> , e.g. <tt>''name=timeline,show=off''</tt> string. To learn about available report names, use <tt>''name=show''<tt> string.}}
*To convert a grdb on the fly to a .gramps xml file:
:<pre>gramps -O myoriginal.grdb 'Family Tree 1' -o e output.gramps -f gramps-xml</pre> * To generate a web site into an other locale (in german): <pre>LANGUAGE=de_DE; LANG=de_DE.UTF-8 gramps -O 'Family Tree 1' -a report -p name=navwebpage,target=/../de </pre>
*Finally, to start normal interactive session type:
{{man index|Gramps 3.1 Wiki Manual - Keybindings|Gramps 3.1 Wiki Manual - About|3.1}}
[[Category:Documentation]]
{{languages|Gramps_3.1_Wiki_Manual_-_Command_Line}}

Navigation menu