Skip to content

Commit

Permalink
Dependencies: remove click-completion
Browse files Browse the repository at this point in the history
As of `click==8.0` the full set of functionality that `click-completion`
provided for our tab-completion is now shipped with `click` itself, so
we can remove this dependency. The main difference is that the string
that is required to activate it, is slightly different and it is shell
dependent. The documentation has been updated to correctly reflect this.
Since it is now shell dependent, the old `verdi completioncommand`,
which was already (unofficially) deprecated is no longer correct. To
keep it correct, one would have to try and detect the shell but this is
clearly outside of the scope of `aiida-core` so we simply remote it.
  • Loading branch information
sphuber committed Oct 28, 2021
1 parent 623ef2b commit 0e33cf5
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 59 deletions.
11 changes: 3 additions & 8 deletions aiida/cmdline/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@
# For further information on the license, see the LICENSE.txt file #
# For further information please visit http://www.aiida.net #
###########################################################################
# pylint: disable=too-many-arguments,wrong-import-position
"""The `verdi` command line interface."""
import click_completion
"""Sub commands of the ``verdi`` command line interface.
# Activate the completion of parameter types provided by the click_completion package
click_completion.init()

# Import to populate the `verdi` sub commands
The commands need to be imported here for them to be registered with the top-level command group.
"""
from aiida.cmdline.commands import (
cmd_archive,
cmd_calcjob,
cmd_code,
cmd_completioncommand,
cmd_computer,
cmd_config,
cmd_daemon,
Expand Down
28 changes: 0 additions & 28 deletions aiida/cmdline/commands/cmd_completioncommand.py

This file was deleted.

27 changes: 24 additions & 3 deletions docs/source/howto/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,32 @@ Configuring your installation
Activating tab-completion
-------------------------
The ``verdi`` command line interface has many commands and parameters, which can be tab-completed to simplify its use.
To enable tab-completion, the following shell command should be executed:
To enable tab-completion, the following shell command should be executed (depending on the shell you use):

.. code:: bash
.. panels::
:container: container-lg pb-3
:column: col-lg-12 p-2

Enable tab-completion for ``verdi`` one of the following supported shells

.. tabbed:: bash

.. code-block:: console
eval "$(_VERDI_COMPLETE=bash_source verdi)"
.. tabbed:: zsh

.. code-block:: console
eval "$(_VERDI_COMPLETE=zsh_source verdi)"
.. tabbed:: fish

.. code-block:: console
eval (env _FOO_BAR_COMPLETE=fish_source foo-bar)
$ eval "$(_VERDI_COMPLETE=source verdi)"
Place this command in your shell or virtual environment activation script to automatically enable tab completion when opening a new shell or activating an environment.
This file is shell specific, but likely one of the following:
Expand Down
1 change: 1 addition & 0 deletions docs/source/nitpick-exceptions
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ py:class click.types.StringParamType
py:class click.types.Path
py:class click.types.File
py:meth click.Option.get_default
py:meth fail

py:class concurrent.futures._base.TimeoutError

Expand Down
18 changes: 0 additions & 18 deletions docs/source/reference/command_line.rst
Original file line number Diff line number Diff line change
Expand Up @@ -80,24 +80,6 @@ Below is a list with all available subcommands.
show Display detailed information for a code.
.. _reference:command-line:verdi-completioncommand:

``verdi completioncommand``
---------------------------

.. code:: console
Usage: [OPTIONS]
Return the code to activate bash completion.
This command is mainly for back-compatibility.
You should rather use: eval "$(_VERDI_COMPLETE=source verdi)"
Options:
--help Show this message and exit.
.. _reference:command-line:verdi-computer:

``verdi computer``
Expand Down
1 change: 0 additions & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ dependencies:
- archive-path~=0.2.1
- aio-pika~=6.6
- circus~=0.17.1
- click-completion~=0.5.1
- click-config-file~=0.6.0
- click-spinner~=0.1.8
- click>=8.0.3,~=8.0
Expand Down
1 change: 0 additions & 1 deletion setup.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"archive-path~=0.2.1",
"aio-pika~=6.6",
"circus~=0.17.1",
"click-completion~=0.5.1",
"click-config-file~=0.6.0",
"click-spinner~=0.1.8",
"click~=8.0,>=8.0.3",
Expand Down

0 comments on commit 0e33cf5

Please sign in to comment.