Normally Bibledit is a graphical program, and the user interacts with it through the keyboard and the mouse. But when arguments are passed to it on the commandline, it changes into a program suitable for scripting.
To get an impression of what scripting possibilities Bibledit offers, run
bibledit --help
This will give a list of options.
There are options for project management, import and export, and so on.
To get more information on a particular option, run that optiion with the --help switch. For example, if you would like to know more about importing a book, run
bibledit --import-book --help
The scripting part and the graphical part of Bibledit all work on the same data. This means, for example, if a book is imported through a script, it will also be available in the graphical version of Bibledit.
Here are just some examples of how to use Bibledit's scripting capabilities.
To export a book to file in USFM format, type
bibledit --export-book --project Ndebele --book Genesis --file /home/joe/Genesis.usfm
This will export Genesis from project Ndebele and write it to file Genesis.usfm in Joe's home directory.
Normally Bibledit's mapping databases are stored in directory /usr/share/bibledit. To export, for example, the English mapping database to a textfile, type
bibledit --process-mapping --export --database /usr/share/bibledit/map_english.sql --textfile map_english.txt
This saves all the mapping data to a textfile named map_english.txt.
To convert a textfile back to a mapping database, use the --read switch instead of the --export switch.
Scipting can access Bibledit's configuration settings. Normally the settings of Bibledit are made in the graphical user interface. But through scripting you can read and write these values too.
The general configuration of Bibledit can be accessed by running command
bibledit --general-configuration
For example, to see whether Bibledit will synchronize all projects on shutdown, type
bibledit --general-configuration --read --key sync_shutdown
This is a boolean value. If it replies "1", that means, true, e.g. Bibledit will sync all projects on shutdown. If it gives "0", that means, false.
To modify the configuration, and have Bibledit synchronize no projects on shutdown, type
bibledit --general-configuration --write --key sync_shutdown --value 0
In the graphical version of Bibledit you can now check this setting and see that it has changed.
Here follows a table of keys, and some information about each key. The first column lists the name of the key. The second one describes what the key is used for. The last column gives what kind of value the key gives, e.g. boolean.
The project configuration of Bibledit can be accessed by running command
bibledit --project-configuration
For example, to see which font Bibledit will use to display project Ndebele, type
bibledit --project-configuration --project Ndebele --read --key editor_font
This is a string value. It will show the name of the font.
To modify the configuration, and have Bibledit use another font, type
bibledit --project-configuration --project Ndebele --write --key editor_font --value 'Bitstream Charter 14'
In the graphical version of Bibledit you can now check this setting and see that it has changed.
Here follows a table of keys, and some information about each key. The first column lists the name of the key. The second one describes what the key is used for. The last column gives what kind of value the key gives, e.g. string.