diff --git a/AUTHORS.rst b/AUTHORS.rst index f15295bf3..6bc2b4c82 100644 --- a/AUTHORS.rst +++ b/AUTHORS.rst @@ -39,6 +39,7 @@ Contributors - Dimitris Apostolou - Dirk Brömmel - Dmitry Bogatov +- Emil Velikov - Ethan Kerrick - FeRD (Frank Dana) - FestplattenSchnitzel diff --git a/docs/man/reuse.rst b/docs/man/reuse.rst index 9ffbd6597..37bbe6446 100644 --- a/docs/man/reuse.rst +++ b/docs/man/reuse.rst @@ -1,6 +1,7 @@ .. SPDX-FileCopyrightText: 2019 Free Software Foundation Europe e.V. SPDX-FileCopyrightText: © 2020 Liferay, Inc. + SPDX-FileCopyrightText: 2024 Emil Velikov SPDX-License-Identifier: CC-BY-SA-4.0 @@ -77,6 +78,12 @@ Options current working directory's VCS repository, or to the current working directory. +.. option:: -s, --print-completion SHELL + + Print a static shell completion file, for the given shell. This option depends + on python-shtab and as such defines which shells are supported. Presently this + includes bash, tcsh and zsh, with fish support being proposed. + .. option:: -h, --help Display help and exit. If no command is provided, this option is implied. diff --git a/src/reuse/_main.py b/src/reuse/_main.py index 37d133056..d4745de67 100644 --- a/src/reuse/_main.py +++ b/src/reuse/_main.py @@ -3,6 +3,7 @@ # SPDX-FileCopyrightText: 2024 Carmen Bianca BAKKER # SPDX-FileCopyrightText: © 2020 Liferay, Inc. # SPDX-FileCopyrightText: 2024 Kerry McAdams +# SPDX-FileCopyrightText: 2024 Emil Velikov # # SPDX-License-Identifier: GPL-3.0-or-later @@ -103,6 +104,12 @@ def parser() -> argparse.ArgumentParser: type=PathType("r", force_directory=True), help=_("define root of project"), ) + try: + import shtab + + shtab.add_argument_to(parser, ["-s", "--print-completion"]) + except ImportError: + pass parser.add_argument( "--version", action="store_true",