-
Notifications
You must be signed in to change notification settings - Fork 52
Expand file tree
/
Copy pathrepository.py
More file actions
77 lines (67 loc) · 2.13 KB
/
Copy pathrepository.py
File metadata and controls
77 lines (67 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import click
from pulp_glue.common.context import (
PulpRemoteContext,
)
from pulp_glue.common.i18n import get_translation
from pulp_glue.rust.context import (
PulpRustRemoteContext,
PulpRustRepositoryContext,
)
from pulp_cli.generic import (
create_command,
destroy_command,
href_option,
label_command,
label_select_option,
list_command,
name_option,
pulp_group,
pulp_labels_option,
repository_href_option,
repository_lookup_option,
resource_option,
retained_versions_option,
show_command,
type_option,
update_command,
version_command,
)
from pulpcore.cli.core.generic import task_command
translation = get_translation(__package__)
_ = translation.gettext
remote_option = resource_option(
"--remote",
default_plugin="rust",
default_type="rust",
context_table={"rust:rust": PulpRustRemoteContext},
href_pattern=PulpRemoteContext.HREF_PATTERN,
help=_("Remote used for syncing in the form '[[<plugin>:]<resource_type>:]<name>' or by href."),
)
@pulp_group()
@type_option(
choices={"rust": PulpRustRepositoryContext},
default="rust",
)
def repository() -> None:
pass
lookup_options = [href_option, name_option, repository_lookup_option]
nested_lookup_options = [repository_href_option, repository_lookup_option]
update_options = [
click.option("--description"),
remote_option,
retained_versions_option,
pulp_labels_option,
]
create_options = update_options + [click.option("--name", required=True)]
repository.add_command(
list_command(
decorators=[label_select_option, click.option("--name-startswith", "name__startswith")]
)
)
repository.add_command(show_command(decorators=lookup_options))
repository.add_command(create_command(decorators=create_options))
repository.add_command(update_command(decorators=lookup_options + update_options))
repository.add_command(destroy_command(decorators=lookup_options))
repository.add_command(task_command(decorators=nested_lookup_options))
repository.add_command(version_command(decorators=nested_lookup_options))
repository.add_command(label_command(decorators=nested_lookup_options))