This repository was archived by the owner on Jan 23, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Expand file tree
/
Copy pathopt.py
More file actions
63 lines (47 loc) · 1.69 KB
/
opt.py
File metadata and controls
63 lines (47 loc) · 1.69 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
from typing import Literal, Optional
import asyncclick as click
opt_log_level = click.option(
"--log-level",
"log_level",
type=click.Choice(["DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"]),
help="Set the log level",
)
opt_kubeconfig = click.option(
"--kubeconfig", "kubeconfig", type=click.File(), default=None, help="path to the kubeconfig file"
)
opt_context = click.option("--context", "context", type=str, default=None, help="Kubernetes context to use")
opt_namespace = click.option("-n", "--namespace", type=str, help="Kubernetes namespace to use", default="default")
opt_labels = click.option("-l", "--label", "labels", type=(str, str), multiple=True, help="Labels")
class OutputMode(str):
JSON = "json"
YAML = "yaml"
NAME = "name"
PATH = "path"
WIDE = "wide"
OutputType = Optional[OutputMode]
opt_output_all = click.option(
"-o",
"--output",
type=click.Choice([OutputMode.JSON, OutputMode.YAML, OutputMode.NAME, OutputMode.WIDE]),
default=None,
help='Output mode. Use "-o name" for shorter output (resource/name).',
)
NameOutputType = Optional[Literal["name"]]
opt_output_name_only = click.option(
"-o",
"--output",
type=click.Choice([OutputMode.NAME]),
default=None,
help='Output mode. Use "-o name" for shorter output (resource/name).',
)
PathOutputType = Optional[Literal["path"]]
opt_output_path_only = click.option(
"-o",
"--output",
type=click.Choice([OutputMode.PATH]),
default=None,
help='Output mode. Use "-o path" for shorter output (file/path).',
)
opt_nointeractive = click.option(
"--nointeractive", is_flag=True, default=False, help="Disable interactive prompts (for use in scripts)."
)