Package init for the cli package.
Module responsible for handling the command line arguments for Gramps.
Bases: object
This class is responsible for the non GUI handling of commands. The handler is passed a parser object, sanitizes it, and can execute the actions requested working on a DbState.
Command-line action routine. Try to perform specified action.
Command-line export routine. Try to write into filename using the family_tree_format.
Command-line import routine. Try to import filename using the family_tree_format.
Depending on the given arguments, import or open data, launch session, write files, and/or perform actions.
Param: | climan: the manager of a CLI session |
---|---|
Type: | CLIManager object |
Method to handle the arguments that can be given for a GUI session.
Returns: | the filename of the family tree that should be opened if user just passed a famtree or a filename. |
---|
Module responsible for handling the command line arguments for Gramps.
Bases: object
This class is responsible for parsing the command line arguments (if any) given to gramps, and determining if a GUI or a CLI session must be started. A filename and/or options may be specified as arguments.
The valid options are:
-O, --open=FAMILY_TREE | |
Open Family Tree | |
-C, --create=FAMILY_TREE | |
Create on open if new Family Tree | |
-i, --import=FILENAME | |
Import file | |
-e, --export=FILENAME | |
Export file | |
-f, --format=FORMAT | |
Specify Family Tree format | |
-a, --action=ACTION | |
Specify action | |
-p, --options=OPTIONS_STRING | |
Specify options | |
-d, --debug=LOGGER_NAME | |
Enable debug logs | |
-l | List Family Trees |
-L | List Family Trees in Detail |
-t | List Family Trees, tab delimited |
-u, --force-unlock | |
Force unlock of Family Tree | |
-s, --show | Show config settings |
-c, --config=SETTINGS | |
Set config setting(s) and start Gramps | |
-y, --yes | Don’t ask to confirm dangerous actions |
-q, --quiet | Suppress progress indication output |
-v, --version | Show versions |
-h, --help | Display the help |
--usage | Display usage information |
If the filename (no options) is specified, the interactive session is launched using data from filename. In this mode (filename, no options), the rest of the arguments are ignored. This is a mode suitable by default for GUI launchers, mime type handlers, and the like.
If no filename or -i option is given, a new interactive session (empty database) is launched, since no data is given anyway.
If -O or -i option is given, but no -e or -a options are given, an interactive session is launched with the FILENAME (specified with -i).
If both input (-O or -i) and processing (-e or -a) options are given, interactive session will not be launched.
When using import ot export options (-i or -e), the -f option may be specified to indicate the family tree format.
Possible values for ACTION are: ‘report’, ‘book’ and ‘tool’.
Configuration SETTINGS may be specified using the -c option. The settings are of the form config.setting[:value]. If used without a value, the setting is shown.
If the -y option is given, the user’s acceptance of any CLI prompt is assumed. (see cli.user.User.prompt())
If the -q option is given, extra noise on sys.stderr, such as progress indicators, is suppressed.
Provide the management of databases from CLI. This includes opening, renaming, creating, and deleting of databases.
Bases: object
Database manager without GTK functionality, allows users to create and open databases
Show the error. A title for the error and an errormessage
Returns (people_count, bsddb_version, schema_version) of current DB. Returns (“Unknown”, “Unknown”, “Unknown”) if invalid DB or other error.
Given a name, return None if name not existing or the path to the database if it is a known database name.
If the directory path is the active path, then return values that indicate to use the icon, and which icon to use.
Attempt to import the provided file into a new database. A new database will only be created if an appropriate importer was found.
Parameters: |
|
---|---|
Returns: | A tuple of (new_path, name) for the new database or (None, None) if no import was performed. |
Provides the startcli function, which the main program calls for CLI execution of Gramps.
Provides also two small base classes: CLIDbLoader, CLIManager
Bases: object
Base class for Db loading action inside a DbState. Only the minimum is present needed for CLI handling
This method takes care of changing database, and loading the data. In 3.0 we only allow reading of real databases of filetype ‘x-directory/normal’
This method should only return on success. Returning on failure makes no sense, because we cannot recover, since database has already been changed. Therefore, any errors should raise exceptions.
On success, return with the disabled signals. The post-load routine should enable signals, as well as finish up with other UI goodies.
Bases: object
Sessionmanager for Gramps. This is in effect a reduced ViewManager instance (see gui/viewmanager), suitable for CLI actions. Aim is to manage a dbstate on which to work (load, unload), and interact with the plugin session
The User class provides basic interaction with the user.
Bases: gramps.gen.user.User
This class provides a means to interact with the user via CLI. It implements the interface in gen.user.User
Start showing a progress indicator to the user.
Parameters: |
|
---|---|
Returns: | none |
Notify the user of a DB error.
Parameters: | error (str) – the error message |
---|---|
Returns: | none |
Notify the user of an error.
Parameters: |
|
---|---|
Returns: | none |
Prompt the user with a message to select an alternative.
Parameters: |
|
---|---|
Returns: | the user’s answer to the question |
Return type: | bool |