38
38
__all__ = ["verbose_option" , "version_option" , "colour_option" ]
39
39
40
40
41
- def verbose_option (help : str = "Show verbose output." ) -> Callable :
41
+ def verbose_option (help_text : str = "Show verbose output." ) -> Callable :
42
42
"""
43
43
Adds an option (via the parameter ``verbose``: :class:`int`) to enable verbose output.
44
44
45
45
The option can be provided multiple times by the user.
46
46
47
- :param help : The help text for the option.
47
+ :param help_text : The help text for the option.
48
48
49
49
:rtype:
50
50
@@ -55,7 +55,7 @@ def verbose_option(help: str = "Show verbose output.") -> Callable:
55
55
"-v" ,
56
56
"--verbose" ,
57
57
count = True ,
58
- help = help ,
58
+ help = help_text ,
59
59
)
60
60
61
61
@@ -82,11 +82,11 @@ def version_option(callback: Callable[[Context, Option, int], Any]) -> Callable:
82
82
)
83
83
84
84
85
- def colour_option (help = "Whether to use coloured output." ) -> Callable :
85
+ def colour_option (help_text = "Whether to use coloured output." ) -> Callable :
86
86
"""
87
87
Adds an option (via the parameter ``colour``: :class:`bool`) to enable verbose output.
88
88
89
- :param help : The help text for the option.
89
+ :param help_text : The help text for the option.
90
90
91
91
:rtype:
92
92
@@ -97,5 +97,44 @@ def colour_option(help="Whether to use coloured output.") -> Callable:
97
97
"--colour/--no-colour" ,
98
98
is_flag = True ,
99
99
default = None ,
100
- help = help ,
100
+ help = help_text ,
101
+ )
102
+
103
+
104
+ def force_option (help_text : str ) -> Callable :
105
+ """
106
+ Decorator to add the ``-f / --force`` option to a click command.
107
+
108
+ :param help_text: The help text for the option.
109
+
110
+ :rtype:
111
+
112
+ .. versionadded:: 0.5.0
113
+ """
114
+
115
+ return click .option (
116
+ "-f" ,
117
+ "--force" ,
118
+ is_flag = True ,
119
+ default = False ,
120
+ help = help_text ,
121
+ )
122
+
123
+
124
+ def no_pager_option (help_text = "Disable the output pager." ) -> Callable :
125
+ """
126
+ Decorator to add the ``--no-pager`` option to a click command.
127
+
128
+ :param help_text: The help text for the option.
129
+
130
+ :rtype:
131
+
132
+ .. versionadded:: 0.5.0
133
+ """
134
+
135
+ return click .option (
136
+ "--no-pager" ,
137
+ is_flag = True ,
138
+ default = False ,
139
+ help = help_text ,
101
140
)
0 commit comments