maestral.cli

This file defines the functions to configure and interact with Maestral from the command line. Some imports are deferred to the functions that required them in order to reduce the startup time of individual CLI commands.

Module Contents

Classes

DropboxPath

A command line parameter representing a Dropbox path

ConfigName

“A command line parameter representing a Dropbox path

OrderedGroup

Click command group with customizable order of help output.

Functions

stop_daemon_with_cli_feedback(config_name: str) → None

Wrapper around daemon.stop_maestral_daemon_process()

select_dbx_path_dialog(config_name: str, default_dir_name: Optional[str] = None, allow_merge: bool = False) → str

A CLI dialog to ask for a local Dropbox folder location.

link_dialog(m: Union['MaestralProxy', 'Maestral']) → None

A CLI dialog for linking a Dropbox account.

check_for_updates() → None

Checks if updates are available by reading the cached release number from the

check_for_fatal_errors(m: Union['MaestralProxy', 'Maestral']) → bool

Checks the given Maestral instance for fatal errors such as revoked Dropbox access,

catch_maestral_errors(func: Callable) → Callable

Decorator that catches a MaestralApiError and prints it as a useful message to the

main(version: bool)

start(foreground: bool, verbose: bool, config_name: str) → None

stop(config_name: str) → None

restart(ctx, foreground: bool, verbose: bool, config_name: str) → None

gui(config_name: str) → None

pause(config_name: str) → None

resume(config_name: str) → None

link(relink: bool, config_name: str) → None

unlink(config_name: str) → None

status(config_name: str) → None

file_status(local_path: str, config_name: str) → None

activity(config_name: str) → None

history(config_name: str) → None

ls(long: bool, dropbox_path: str, include_deleted: bool, config_name: str) → None

account_info(config_name: str) → None

configs() → None

about() → None

autostart(yes: bool, no: bool, config_name: str) → None

excluded()

excluded_list(config_name: str) → None

excluded_add(dropbox_path: str, config_name: str) → None

excluded_remove(dropbox_path: str, config_name: str) → None

notify()

notify_level(level_name: str, config_name: str) → None

notify_snooze(minutes: int, config_name: str) → None

analytics(yes: bool, no: bool, config_name: str) → None

move_dir(new_path: str, config_name: str) → None

rebuild_index(config_name: str) → None

restore(dropbox_path: str, rev: str, config_name: str) → None

log()

log_show(external: bool, config_name: str) → None

log_clear(config_name: str) → None

log_level(level_name: str, config_name: str) → None

maestral.cli.OK[source]
maestral.cli.FAILED[source]
maestral.cli.KILLED[source]
maestral.cli.stop_daemon_with_cli_feedback(config_name: str)None[source]

Wrapper around daemon.stop_maestral_daemon_process() with command line feedback.

maestral.cli.select_dbx_path_dialog(config_name: str, default_dir_name: Optional[str] = None, allow_merge: bool = False)str[source]

A CLI dialog to ask for a local Dropbox folder location.

Parameters
  • config_name – The configuration to use for the default folder name.

  • default_dir_name – The default directory name. Defaults to “Dropbox ({config_name})” if not given.

  • allow_merge – If True, allows the selection of an existing folder without deleting it. Defaults to False.

Returns

Path given by user.

A CLI dialog for linking a Dropbox account.

Parameters

m – Proxy to Maestral daemon.

maestral.cli.check_for_updates()None[source]

Checks if updates are available by reading the cached release number from the config file and notifies the user. Prints an update note to the command line.

maestral.cli.check_for_fatal_errors(m: Union[‘MaestralProxy’, ‘Maestral’])bool[source]

Checks the given Maestral instance for fatal errors such as revoked Dropbox access, deleted Dropbox folder etc. Prints a nice representation to the command line.

Parameters

m – Proxy to Maestral daemon or Maestral instance.

Returns

True in case of fatal errors, False otherwise.

maestral.cli.catch_maestral_errors(func: Callable) → Callable[source]

Decorator that catches a MaestralApiError and prints it as a useful message to the command line instead of printing the full stacktrace.

class maestral.cli.DropboxPath(file_okay: bool = True, dir_okay: bool = True)[source]

Bases: click.ParamType

A command line parameter representing a Dropbox path

Parameters
  • file_okay – Controls if a file is a possible value.

  • dir_okay – Controls if a directory is a possible value.

name = Dropbox path[source]
envvar_list_splitter[source]
class maestral.cli.ConfigName(existing: bool = True)[source]

Bases: click.ParamType

“A command line parameter representing a Dropbox path

Parameters

existing – If True require an existing config, otherwise create a new config on demand.

name = config[source]
convert(self, value: Optional[str], param: Optional[click.Parameter], ctx: Optional[click.Context]) → Optional[str][source]
class maestral.cli.OrderedGroup[source]

Bases: click.Group

Click command group with customizable order of help output.

command(self, *args, **kwargs) → Callable[source]

Behaves the same as click.Group.command() except captures a section name for listing command names in help.

group(self, *args, **kwargs) → Callable[source]

Behaves the same as click.Group.group() except captures a section name for listing command names in help.

format_commands(self, ctx: click.Context, formatter: click.HelpFormatter)None[source]

Extra format methods for multi methods that adds all the commands after the options.

maestral.cli.main(version: bool)[source]
maestral.cli.config_option[source]
maestral.cli.existing_config_option[source]
maestral.cli.start(foreground: bool, verbose: bool, config_name: str)None[source]
maestral.cli.stop(config_name: str)None[source]
maestral.cli.restart(ctx, foreground: bool, verbose: bool, config_name: str)None[source]
maestral.cli.gui(config_name: str)None[source]
maestral.cli.pause(config_name: str)None[source]
maestral.cli.resume(config_name: str)None[source]
maestral.cli.status(config_name: str)None[source]
maestral.cli.file_status(local_path: str, config_name: str)None[source]
maestral.cli.activity(config_name: str)None[source]
maestral.cli.history(config_name: str)None[source]
maestral.cli.ls(long: bool, dropbox_path: str, include_deleted: bool, config_name: str)None[source]
maestral.cli.account_info(config_name: str)None[source]
maestral.cli.configs()None[source]
maestral.cli.about()None[source]
maestral.cli.autostart(yes: bool, no: bool, config_name: str)None[source]
maestral.cli.excluded()[source]
maestral.cli.excluded_list(config_name: str)None[source]
maestral.cli.excluded_add(dropbox_path: str, config_name: str)None[source]
maestral.cli.excluded_remove(dropbox_path: str, config_name: str)None[source]
maestral.cli.notify()[source]
maestral.cli.notify_level(level_name: str, config_name: str)None[source]
maestral.cli.notify_snooze(minutes: int, config_name: str)None[source]
maestral.cli.analytics(yes: bool, no: bool, config_name: str)None[source]
maestral.cli.move_dir(new_path: str, config_name: str)None[source]
maestral.cli.rebuild_index(config_name: str)None[source]
maestral.cli.restore(dropbox_path: str, rev: str, config_name: str)None[source]
maestral.cli.log()[source]
maestral.cli.log_show(external: bool, config_name: str)None[source]
maestral.cli.log_clear(config_name: str)None[source]
maestral.cli.log_level(level_name: str, config_name: str)None[source]