maestral.cli.core ================= .. py:module:: maestral.cli.core .. autoapi-nested-parse:: This module provides custom click command line parameters for Maestral such :class:`DropboxPath`, :class:`ConfigKey` and :class:`ConfigName`, as well as an ordered command group class which prints its help output in sections. Module Contents --------------- .. py:class:: DropboxPath(file_okay = True, dir_okay = True) Bases: :py:obj:`click.ParamType` A command line parameter representing a Dropbox path This parameter type provides custom shell completion for items inside the local Dropbox folder. :param file_okay: Controls if a file is a possible value. :param dir_okay: Controls if a directory is a possible value. .. py:attribute:: name :value: 'Dropbox path' .. py:attribute:: envvar_list_splitter .. py:attribute:: file_okay .. py:attribute:: dir_okay .. py:method:: convert(value, param, ctx) Convert the value to the correct type. This is not called if the value is ``None`` (the missing value). This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types. The ``param`` and ``ctx`` arguments may be ``None`` in certain situations, such as when converting prompt input. If the value cannot be converted, call :meth:`fail` with a descriptive message. :param value: The value to convert. :param param: The parameter that is using this type to convert its value. May be ``None``. :param ctx: The current context that arrived at this value. May be ``None``. .. py:method:: shell_complete(ctx, param, incomplete) Return a list of :class:`~click.shell_completion.CompletionItem` objects for the incomplete value. Most types do not provide completions, but some do, and this allows custom types to provide custom completions as well. :param ctx: Invocation context for this command. :param param: The parameter that is requesting completion. :param incomplete: Value being completed. May be empty. .. versionadded:: 8.0 .. py:class:: ConfigKey Bases: :py:obj:`click.ParamType` A command line parameter representing a config key This parameter type provides custom shell completion for existing config keys. .. py:attribute:: name :value: 'key' .. py:method:: shell_complete(ctx, param, incomplete) Return a list of :class:`~click.shell_completion.CompletionItem` objects for the incomplete value. Most types do not provide completions, but some do, and this allows custom types to provide custom completions as well. :param ctx: Invocation context for this command. :param param: The parameter that is requesting completion. :param incomplete: Value being completed. May be empty. .. versionadded:: 8.0 .. py:class:: ConfigName(existing = True) Bases: :py:obj:`click.ParamType` A command line parameter representing a Dropbox path This parameter type provides custom shell completion for existing config names. :param existing: If ``True`` require an existing config, otherwise create a new config on demand. .. py:attribute:: name :value: 'config' .. py:attribute:: existing .. py:method:: convert(value, param, ctx) Convert the value to the correct type. This is not called if the value is ``None`` (the missing value). This must accept string values from the command line, as well as values that are already the correct type. It may also convert other compatible types. The ``param`` and ``ctx`` arguments may be ``None`` in certain situations, such as when converting prompt input. If the value cannot be converted, call :meth:`fail` with a descriptive message. :param value: The value to convert. :param param: The parameter that is using this type to convert its value. May be ``None``. :param ctx: The current context that arrived at this value. May be ``None``. .. py:method:: shell_complete(ctx, param, incomplete) Return a list of :class:`~click.shell_completion.CompletionItem` objects for the incomplete value. Most types do not provide completions, but some do, and this allows custom types to provide custom completions as well. :param ctx: Invocation context for this command. :param param: The parameter that is requesting completion. :param incomplete: Value being completed. May be empty. .. versionadded:: 8.0 .. py:class:: OrderedGroup(name = None, commands = None, **attrs) Bases: :py:obj:`click.Group` Click command group with customizable sections of help output. .. py:attribute:: sections :type: dict[str, list[tuple[str, click.Command]]] .. py:method:: add_command(cmd, name = None, section = '') Registers another :class:`Command` with this group. If the name is not provided, the name of the command is used. .. py:method:: format_commands(ctx, formatter) Extra format methods for multi methods that adds all the commands after the options. .. py:exception:: CliException(message) Bases: :py:obj:`click.ClickException` Subclass of :class:`click.CliException` exception with a nicely formatted error message. .. py:method:: show(file = None)