Karana.KUtils.Kclick
====================

.. py:module:: Karana.KUtils.Kclick

.. autoapi-nested-parse::

   Classes and functions used to create a Kclick CLI application.

   This module contains classes and functions used to create Kclick CLI
   applications. Kclick is a thin wrapper around the third-party, open-source
   click package, which is used to quickly generate high-quality CLI applications.



Attributes
----------

.. autoapisummary::

   Karana.KUtils.Kclick.kclick_options
   Karana.KUtils.Kclick.output_type
   Karana.KUtils.Kclick.cfg_file


Classes
-------

.. autoapisummary::

   Karana.KUtils.Kclick.KGroup


Functions
---------

.. autoapisummary::

   Karana.KUtils.Kclick.error
   Karana.KUtils.Kclick.cli
   Karana.KUtils.Kclick.test
   Karana.KUtils.Kclick.runCli


Module Contents
---------------

.. py:data:: kclick_options

.. py:data:: output_type
   :value: ''


.. py:data:: cfg_file
   :value: ''


.. py:function:: error(err: str)

   Print out error text in red.


.. py:class:: KGroup(name: str | None = None, commands: collections.abc.MutableMapping[str, Command] | collections.abc.Sequence[Command] | None = None, invoke_without_command: bool = False, no_args_is_help: bool | None = None, subcommand_metavar: str | None = None, chain: bool = False, result_callback: Callable[Ellipsis, Any] | None = None, **kwargs: Any)

   Bases: :py:obj:`click.Group`


   Thin wrapper around click.Group that simplifies command functions.

   Command functions need only return the incoming `kwargs`. The logic used
   here will automatically update the kclick_options with said kwargs.


   .. py:method:: add_command(cmd: click.Command, name: Optional[str] = None)

      Thin wrapper around click.Group.add_command that simplifies command functions.

      Command functions need only return the incoming `kwargs`. The logic used
      here will automatically update the kclick_options with said kwargs.



.. py:function:: cli(ctx, **kwargs)

   Major click group.

   This is the main click group used for all Kclick CLI applications. Commands and
   options can be added to this group, and they will show up in your Kclick CLI
   application.


.. py:function:: test(ctx, **kwargs)

   Kclick cli group callback.

   This callback merges all options from all commands.


.. py:function:: runCli() -> tuple[click.core.Context, dict[str, Any]]

   Run the Kclick cli group and return the parsed results.

   Run the Kclick cli group, which will parse the incoming CLI options.
   This is then merged into a single dictionary with all the final option
   values.

   :returns: A tuple where the first element is the click context object and the second
             is the CLI options.
   :rtype: tuple[click.core.Context, dict[str, Any]]


