Command line interface

module: rspub.cli.rscli

Command line interface to publish resources under the ResourceSync Framework

The module rscli.py offers an interface to configure, select and run the publishing of resources under the ResourceSync framework. Start rscli from anywhere on the system:

python3 rspub/cli/rscli.py

The internals of the command line interface resemble a three-room house. You enter the house in the rspub room. From there you can enter the rooms configure and select. You leave the rooms and the house by typing exit. In all rooms you can get help by typing help.

../_images/rscli.png

Fig. 1. Geography of rscli.

rspub.cli.rscli.str2bool(v, none=False)[source]
class rspub.cli.rscli.SuperCmd[source]

Bases: cmd.Cmd

stop = False
__init__()[source]
postcmd(stop, line)[source]
do_exit(line)[source]
help_exit()[source]
do_EOF(line)[source]

EOF, Ctrl+D, Ctrl+C:

Exit the application.
static complete_configuration(text)[source]
do_list_configurations(line)[source]

list_configurations:

List saved configurations
do_list_parameters(line)[source]

list_parameters:

List current parameters
class rspub.cli.rscli.RsPub[source]

Bases: rspub.cli.rscli.SuperCmd, rspub.util.observe.EventObserver

prompt = 'rspub > '
intro = '================================================== \nCommand Line Interface for ResourceSync Publishing \n================================================== \n-> For help type: help'
__init__()[source]
do_configure(line)[source]

configure:

Switch to configuration mode
do_select(line)[source]

select:

Switch to select mode
do_run(line)[source]

run:

run rspub with the current configuration.
do_exit(line)[source]

EOF, Ctrl+D, Ctrl+C:

Exit the application.
confirm_clear_metadata_directory(*args, **kwargs)[source]
static inform_completed_document(*args, **kwargs)[source]
static inform_execution_end(*args, **kwargs)[source]
class rspub.cli.rscli.Configure[source]

Bases: rspub.cli.rscli.SuperCmd

prompt = 'configure > '
intro = '============================= \nConfigure Metadata Publishing \n============================= \n-> For help type: help'
__init__()[source]
do_open_configuration(name)[source]

open_configuration [name]:

Open a saved configuration
complete_open_configuration(text, line, begidx, endidx)[source]
do_save_configuration(name)[source]

save_configuration [name]:

Save the current configuration as (name)
do_remove_configuration(name)[source]

remove_configuration [name]:

Remove a saved configuration
complete_remove_configuration(text, line, begidx, endidx)[source]
do_reset(line)[source]

reset:

Reset the configuration to default settings.
do_resource_dir(path)[source]

resource_dir:

resource_dir         - Get the parameter
resource_dir [path]  - Set the parameter
----------------------------------------
The resource_dir acts as the root of the resources to be published.
The urls to the resources are calculated relative to the resource_dir.
complete_resource_dir(text, line, begidx, endidx)[source]
do_metadata_dir(path)[source]

metadata_dir:

metadata_dir         - Get the parameter
metadata_dir [path]  - Set the parameter
----------------------------------------
The metadata_dir is where sitemaps will be stored.
The metadata_dir is always relative to the resource_dir
do_description_dir(path)[source]

description_dir:

description_dir         - Get the parameter
description_dir [path]  - Set the parameter
description_dir None    - Reset the parameter
---------------------------------------------
The path to the directory of the (local copy of) the source description,
aka '.well-known/resourcesync'
complete_description_dir(text, line, begidx, endidx)[source]
do_url_prefix(url)[source]

url_prefix:

url_prefix           - Get the parameter
url_prefix [prefix]  - Set the parameter
----------------------------------------
The url_prefix is used to prefix urls to documents and resources.
do_has_wellknown_at_root(value)[source]

has_wellknown_at_root:

has_wellknown_at_root             - Get the parameter
has_wellknown_at_root (yes | no)  - Set the parameter
----------------------------------------------------
The description document '.well-known/resourcesync' is at the root
of the server address.
do_strategy(name)[source]

strategy:

strategy             - Get the parameter
strategy [strategy]  - Set the parameter
----------------------------------------
The strategy determines what will be done by ResourceSync upon execution.
complete_strategy(text, line, begidx, endidx)[source]
do_discard_selector_file(line)[source]

discard_selector_file:

Remove the association between this configuration and selector (if any).
An association between a configuration and a selector is set after execution
of ResourceSync with a Selector as file selector.
do_select_mode(mode)[source]

select_mode:

select_mode         - Get the parameter
select_mode [mode]  - Set the parameter
---------------------------------------
Mode for selecting resources.
complete_select_mode(text, line, begidx, endidx)[source]
do_plugin_dir(path)[source]

plugin_dir:

plugin_dir         - Get the parameter
plugin_dir [path]  - Set the parameter
plugin_dir None    - Reset the parameter
---------------------------------------
The directory where plugins can be found.
complete_plugin_dir(text, line, begidx, endidx)[source]
do_max_items_in_list(value)[source]

max_items_in_list:

max_items_in_list                   - Get the parameter
max_items_in_list (int, 1 - 50000)  - Set the parameter
------------------------------------------------------
The maximum amount of records in a sitemap.
do_zero_fill_filename(value)[source]

zero_fill_filename:

zero_fill_filename                - Get the parameter
zero_fill_filename (int, 1 - 10)  - Set the parameter
----------------------------------------------------
The amount of digits in a sitemap filename.
do_is_saving_pretty_xml(value)[source]

is_saving_pretty_xml:

is_saving_pretty_xml             - Get the parameter
is_saving_pretty_xml (yes | no)  - Set the parameter
---------------------------------------------------
Determines appearance of sitemap xml.
do_is_saving_sitemaps(value)[source]

is_saving_sitemaps:

is_saving_sitemaps             - Get the parameter
is_saving_sitemaps (yes | no)  - Set the parameter
-------------------------------------------------
Determines if sitemaps will be written to disk.
class rspub.cli.rscli.Select[source]

Bases: rspub.cli.rscli.SuperCmd

prompt = 'select > '
intro = '======================================= \nSelect data for ResourceSync Publishing \n======================================= \n-> For help type: help'
__init__()[source]
do_load_selector(path)[source]

load_selector:

load_selector [path] - Load Selector from location [path]
---------------------------------------------------------
If the current Selector has unsaved changes, you will be
prompted to save or discard.
complete_load_selector(text, line, begidx, endidx)[source]
do_save_selector(path)[source]

save_selector:

save_selector         - Save current selector
save_selector [path]  - Save current selector as [path]
complete_save_selector(text, line, begidx, endidx)[source]
do_include_path(path)[source]

include_path:

include_path [path] - Add a file or directory to the collection of includes.
----------------------------------------------------------------------------
The [path] can be relative or absolute.
complete_include_path(text, line, begidx, endidx)[source]
do_list_includes(line)[source]

list_includes:

List absolute filenames of the included files.
do_exclude_path(path)[source]

exclude_path:

exclude_path [path] - Add a file or directory to the collection of excludes.
----------------------------------------------------------------------------
The [path] can be relative or absolute.
complete_exclude_path(text, line, begidx, endidx)[source]
do_list_excludes(line)[source]

list_excludes:

List absolute filenames of the excluded files.
do_list_selected(line)[source]

list_selected:

List absolute filenames of the selected files. The selected files are
the relative complement of excludes with respect to includes.
(list_includes \ list_excludes)
do_read_includes(path)[source]

read_includes:

read_includes [path]  - Read included filenames from a file at [path]
complete_read_includes(text, line, begidx, endidx)[source]
do_read_excludes(path)[source]

read_excludes:

read_excludes [path]  - Read excluded filenames from a file at [path]
complete_read_excludes(text, line, begidx, endidx)[source]
do_clear_includes(line)[source]

clear_includes:

Clear included filenames from selector.
do_clear_excludes(line)[source]

clear_excludes:

Clear excluded filenames from selector.
do_discard_include(path)[source]

discard_include:

discard_include [path]  - Remove [path] from included filenames.
complete_discard_include(text, line, begidx, endidx)[source]
do_discard_exclude(path)[source]

discard_exclude:

discard_exclude [path]  - Remove [path] from excluded filenames.
complete_discard_exclude(text, line, begidx, endidx)[source]
do_get_included_entries(line)[source]

get_included_entries:

List included entries.
do_get_excluded_entries(line)[source]

get_excluded_entries:

List excluded entries.
check_exit()[source]
do_exit(line)[source]
do_EOF(line)[source]

EOF, Ctrl+D, Ctrl+C:

Exit the application.