Marco Ricci commited on 2025-01-23 10:51:36
Zeige 1 geänderte Dateien mit 41 Einfügungen und 45 Löschungen.
... | ... |
@@ -1071,6 +1071,46 @@ if ( |
1071 | 1071 |
# ========= |
1072 | 1072 |
|
1073 | 1073 |
|
1074 |
+# Portions of this class are based directly on code from click 8.1. |
|
1075 |
+# (This does not in general include docstrings, unless otherwise noted.) |
|
1076 |
+# They are subject to the 3-clause BSD license in the following |
|
1077 |
+# paragraphs. Modifications to their code are marked with respective |
|
1078 |
+# comments; they too are released under the same license below. The |
|
1079 |
+# original code did not contain any "noqa" or "pragma" comments. |
|
1080 |
+# |
|
1081 |
+# Copyright 2024 Pallets |
|
1082 |
+# |
|
1083 |
+# Redistribution and use in source and binary forms, with or |
|
1084 |
+# without modification, are permitted provided that the |
|
1085 |
+# following conditions are met: |
|
1086 |
+# |
|
1087 |
+# 1. Redistributions of source code must retain the above |
|
1088 |
+# copyright notice, this list of conditions and the |
|
1089 |
+# following disclaimer. |
|
1090 |
+# |
|
1091 |
+# 2. Redistributions in binary form must reproduce the above |
|
1092 |
+# copyright notice, this list of conditions and the |
|
1093 |
+# following disclaimer in the documentation and/or other |
|
1094 |
+# materials provided with the distribution. |
|
1095 |
+# |
|
1096 |
+# 3. Neither the name of the copyright holder nor the names |
|
1097 |
+# of its contributors may be used to endorse or promote |
|
1098 |
+# products derived from this software without specific |
|
1099 |
+# prior written permission. |
|
1100 |
+# |
|
1101 |
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
|
1102 |
+# CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, |
|
1103 |
+# INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
1104 |
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
1105 |
+# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
|
1106 |
+# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
1107 |
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
|
1108 |
+# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
|
1109 |
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
|
1110 |
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
|
1111 |
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR |
|
1112 |
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
|
1113 |
+# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
1074 | 1114 |
class _DefaultToVaultGroup(CommandWithHelpGroups, click.Group): |
1075 | 1115 |
"""A helper class to implement the default-to-"vault"-subcommand behavior. |
1076 | 1116 |
|
... | ... |
@@ -1082,51 +1122,7 @@ class _DefaultToVaultGroup(CommandWithHelpGroups, click.Group): |
1082 | 1122 |
def resolve_command( |
1083 | 1123 |
self, ctx: click.Context, args: list[str] |
1084 | 1124 |
) -> tuple[str | None, click.Command | None, list[str]]: |
1085 |
- """Resolve a command, but default to "vault" instead of erroring out. |
|
1086 |
- |
|
1087 |
- Based on code from click 8.1, which appears to be essentially |
|
1088 |
- untouched since at least click 3.2. Subject to the following |
|
1089 |
- license (3-clause BSD license): |
|
1090 |
- |
|
1091 |
- Copyright 2024 Pallets |
|
1092 |
- |
|
1093 |
- Redistribution and use in source and binary forms, with or |
|
1094 |
- without modification, are permitted provided that the following |
|
1095 |
- conditions are met: |
|
1096 |
- |
|
1097 |
- 1. Redistributions of source code must retain the above |
|
1098 |
- copyright notice, this list of conditions and the following |
|
1099 |
- disclaimer. |
|
1100 |
- |
|
1101 |
- 2. Redistributions in binary form must reproduce the above |
|
1102 |
- copyright notice, this list of conditions and the following |
|
1103 |
- disclaimer in the documentation and/or other materials |
|
1104 |
- provided with the distribution. |
|
1105 |
- |
|
1106 |
- 3. Neither the name of the copyright holder nor the names of |
|
1107 |
- its contributors may be used to endorse or promote products |
|
1108 |
- derived from this software without specific prior written |
|
1109 |
- permission. |
|
1110 |
- |
|
1111 |
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND |
|
1112 |
- CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, |
|
1113 |
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF |
|
1114 |
- MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
|
1115 |
- DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR |
|
1116 |
- CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
1117 |
- SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
1118 |
- LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF |
|
1119 |
- USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED |
|
1120 |
- AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
|
1121 |
- LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING |
|
1122 |
- IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF |
|
1123 |
- THE POSSIBILITY OF SUCH DAMAGE. |
|
1124 |
- |
|
1125 |
- Modifications to this routine are marked with "modifications for |
|
1126 |
- derivepassphrase". Furthermore, all "pragma" and "noqa" comments |
|
1127 |
- are also modifications for derivepassphrase. |
|
1128 |
- |
|
1129 |
- """ # noqa: DOC201 |
|
1125 |
+ """Resolve a command, defaulting to "vault" instead of erroring out.""" # noqa: DOC201 |
|
1130 | 1126 |
cmd_name = click.utils.make_str(args[0]) |
1131 | 1127 |
|
1132 | 1128 |
# Get the command |
1133 | 1129 |