|
46 | 46 |
|
47 | 47 | log = logging.getLogger(__name__)
|
48 | 48 |
|
| 49 | +PREVIEW_PREFIX = "" |
| 50 | + |
49 | 51 |
|
50 | 52 | class SortedTyperGroup(TyperGroup):
|
51 | 53 | def list_commands(self, ctx: click.Context) -> List[str]:
|
@@ -107,18 +109,17 @@ def command(
|
107 | 109 |
|
108 | 110 | def custom_command(command_callable):
|
109 | 111 | """Custom command wrapper similar to Typer.command."""
|
110 |
| - # Sanitize doc string which is used to create help in terminal |
111 | 112 | command_callable.__doc__ = sanitize_for_terminal(command_callable.__doc__)
|
112 | 113 |
|
113 | 114 | if preview and command_callable.__doc__:
|
114 |
| - if not command_callable.__doc__.strip().startswith("(preview)"): |
| 115 | + if not command_callable.__doc__.strip().startswith(PREVIEW_PREFIX): |
115 | 116 | command_callable.__doc__ = (
|
116 |
| - f"(preview) {command_callable.__doc__.strip()}" |
| 117 | + f"{PREVIEW_PREFIX}{command_callable.__doc__.strip()}" |
117 | 118 | )
|
118 | 119 |
|
119 | 120 | if preview and "help" in kwargs and kwargs["help"]:
|
120 |
| - if not kwargs["help"].strip().startswith("(preview)"): |
121 |
| - kwargs["help"] = f"(preview) {kwargs['help'].strip()}" |
| 121 | + if not kwargs["help"].strip().startswith(PREVIEW_PREFIX): |
| 122 | + kwargs["help"] = f"{PREVIEW_PREFIX}{kwargs['help'].strip()}" |
122 | 123 |
|
123 | 124 | if requires_connection:
|
124 | 125 | command_callable = global_options_with_connection(command_callable)
|
@@ -256,8 +257,8 @@ def __init__(
|
256 | 257 | def create_instance(self) -> SnowTyper:
|
257 | 258 | help_text = self.help
|
258 | 259 | if self.preview and help_text:
|
259 |
| - if not help_text.strip().startswith("(preview)"): |
260 |
| - help_text = f"(preview) {help_text.strip()}" |
| 260 | + if not help_text.strip().startswith(PREVIEW_PREFIX): |
| 261 | + help_text = f"{PREVIEW_PREFIX}{help_text.strip()}" |
261 | 262 |
|
262 | 263 | app = SnowTyper(
|
263 | 264 | name=self.name,
|
|
0 commit comments