| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -21,7 +21,7 @@ | |||
| 21 | 21 | import functools | |
| 22 | 22 | import re | |
| 23 | 23 | import sys | |
| 24 | - from typing import Any, Callable, Dict, Tuple | ||
| 24 | + from typing import Any, Callable, Dict, Optional, Tuple | ||
| 25 | 25 | ||
| 26 | 26 | import gitlab.config | |
| 27 | 27 | ||
@@ -36,9 +36,12 @@ | |||
| 36 | 36 | ||
| 37 | 37 | ||
| 38 | 38 | def register_custom_action( | |
| 39 | - cls_names, mandatory: Tuple[Any, ...] = tuple(), optional: Tuple[Any, ...] = tuple() | ||
| 39 | + cls_names, | ||
| 40 | + mandatory: Tuple[Any, ...] = tuple(), | ||
| 41 | + optional: Tuple[Any, ...] = tuple(), | ||
| 42 | + custom_action: Optional[str] = None, | ||
| 40 | 43 | ) -> Callable: | |
| 41 | - def wrap(f) -> Callable: | ||
| 44 | + def wrap(f, custom_action: Optional[str] = custom_action) -> Callable: | ||
| 42 | 45 | @functools.wraps(f) | |
| 43 | 46 | def wrapped_f(*args, **kwargs): | |
| 44 | 47 | return f(*args, **kwargs) | |
@@ -57,7 +60,7 @@ def wrapped_f(*args, **kwargs): | |||
| 57 | 60 | if final_name not in custom_actions: | |
| 58 | 61 | custom_actions[final_name] = {} | |
| 59 | 62 | ||
| 60 | - action = f.__name__.replace("_", "-") | ||
| 63 | + action = custom_action or f.__name__.replace("_", "-") | ||
| 61 | 64 | custom_actions[final_name][action] = (mandatory, optional, in_obj) | |
| 62 | 65 | ||
| 63 | 66 | return wrapped_f | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -48,7 +48,7 @@ class MergeRequestPipelineManager(CreateMixin, ListMixin, RESTManager): | |||
| 48 | 48 | # mr.pipelines(), execute the deprecated method for now. | |
| 49 | 49 | # TODO: in python-gitlab 3.0.0, remove this method entirely. | |
| 50 | 50 | ||
| 51 | - @cli.register_custom_action("ProjectMergeRequest") | ||
| 51 | + @cli.register_custom_action("ProjectMergeRequest", custom_action="pipelines") | ||
| 52 | 52 | @exc.on_http_error(exc.GitlabListError) | |
| 53 | 53 | def __call__(self, **kwargs): | |
| 54 | 54 | """List the merge request pipelines. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments