From f9ec31970e30d9bfe64ab0af170cde01ad4eab37 Mon Sep 17 00:00:00 2001 From: kotfu Date: Mon, 30 Jan 2023 17:55:16 -0700 Subject: Add documentation for allow_clipboard attribute --- docs/api/cmd.rst | 7 +++++++ docs/features/clipboard.rst | 8 ++++++++ 2 files changed, 15 insertions(+) (limited to 'docs') diff --git a/docs/api/cmd.rst b/docs/api/cmd.rst index 6fdfbf27..f9bd07c6 100644 --- a/docs/api/cmd.rst +++ b/docs/api/cmd.rst @@ -65,3 +65,10 @@ cmd2.Cmd The symbol name which :ref:`features/scripting:Python Scripts` run using the :ref:`features/builtin_commands:run_pyscript` command can use to reference the parent ``cmd2`` application. + + .. attribute:: allow_clipboard + + If ``True``, ``cmd2`` will allow output to be written to or appended to + the operating system pasteboard. If ``False``, this capability will not + be allowed. See :ref:`features/clipboard:Clipboard Integration` for more + information. diff --git a/docs/features/clipboard.rst b/docs/features/clipboard.rst index 73e206c2..a4b9cdf2 100644 --- a/docs/features/clipboard.rst +++ b/docs/features/clipboard.rst @@ -25,6 +25,14 @@ contents of the clipboard by ending the command with two greater than symbols: Developers ---------- +You can control whether the above user features of adding output to the +operating system clipboard are allowed for the user by setting the +:attr:`~cmd2.Cmd.allow_clipboard` attribute. The default value is ``True``. +Set it to ``False`` and the above functionality will generate an error +message instead of adding the output to the clipboard. +:attr:`~cmd2.Cmd.allow_clipboard` can be set upon initialization, and you can +change it at any time from within your code. + If you would like your ``cmd2`` based application to be able to use the clipboard in additional or alternative ways, you can use the following methods (which work uniformly on Windows, macOS, and Linux). -- cgit v1.2.1