validio-cli 0.11.0__tar.gz → 0.13.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {validio_cli-0.11.0 → validio_cli-0.13.0}/PKG-INFO +2 -2
- {validio_cli-0.11.0 → validio_cli-0.13.0}/pyproject.toml +2 -2
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/code.py +21 -41
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/sources.py +39 -3
- validio_cli-0.13.0/validio_cli/bin/main.py +177 -0
- validio_cli-0.11.0/validio_cli/bin/main.py +0 -83
- {validio_cli-0.11.0 → validio_cli-0.13.0}/LICENSE +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/README_PUBLIC.md +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/__init__.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/channels.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/config.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/credentials.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/dbt.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/incidents.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/metrics.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/notification_rules.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/recommendations.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/resources.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/segmentations.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/segments.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/users.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/validators.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/bin/entities/windows.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/components.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/metadata.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/namespace.py +0 -0
- {validio_cli-0.11.0 → validio_cli-0.13.0}/validio_cli/schema.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: validio-cli
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.13.0
|
|
4
4
|
Summary: CLI tool to interact with the Validio platform
|
|
5
5
|
Home-page: https://validio.io/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -12,7 +12,7 @@ Classifier: Programming Language :: Python :: 3
|
|
|
12
12
|
Classifier: Programming Language :: Python :: 3.10
|
|
13
13
|
Classifier: Programming Language :: Python :: 3.11
|
|
14
14
|
Requires-Dist: camel-converter (>=3.0.0,<4.0.0)
|
|
15
|
-
Requires-Dist: classdiff (>=0.
|
|
15
|
+
Requires-Dist: classdiff (>=0.3.0,<0.4.0)
|
|
16
16
|
Requires-Dist: prompt-toolkit (>=3.0.38,<4.0.0)
|
|
17
17
|
Requires-Dist: pydantic (==2.4.2)
|
|
18
18
|
Requires-Dist: tabulate (>=0.9.0,<0.10.0)
|
|
@@ -3,7 +3,7 @@ name = "validio-cli"
|
|
|
3
3
|
# This version does not represent the released version or any tag. For each
|
|
4
4
|
# release we automatically bump this before building and publishing so this
|
|
5
5
|
# should be kept at 0.0.1dev1
|
|
6
|
-
version = "0.
|
|
6
|
+
version = "0.13.0"
|
|
7
7
|
description = "CLI tool to interact with the Validio platform"
|
|
8
8
|
authors = ["Validio <support@validio.io>"]
|
|
9
9
|
license = "Apache-2.0"
|
|
@@ -15,7 +15,7 @@ readme = "README_PUBLIC.md"
|
|
|
15
15
|
[tool.poetry.dependencies]
|
|
16
16
|
python = "^3.10"
|
|
17
17
|
camel-converter = "^3.0.0"
|
|
18
|
-
classdiff = "^0.
|
|
18
|
+
classdiff = "^0.3.0"
|
|
19
19
|
validio-sdk = "*"
|
|
20
20
|
typer = {extras = ["all"], version = "^0.7.0"}
|
|
21
21
|
prompt-toolkit = "^3.0.38"
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import os
|
|
2
2
|
import pathlib
|
|
3
|
-
import re
|
|
4
3
|
import sys
|
|
5
4
|
from collections.abc import Mapping
|
|
6
5
|
from enum import Enum
|
|
@@ -334,23 +333,6 @@ async def _plan(
|
|
|
334
333
|
return diff, manifest_ctx
|
|
335
334
|
|
|
336
335
|
|
|
337
|
-
# https://stackoverflow.com/a/14693789/2274551
|
|
338
|
-
ansi_escape = re.compile(
|
|
339
|
-
r"""
|
|
340
|
-
\x1B # ESC
|
|
341
|
-
(?: # 7-bit C1 Fe (except CSI)
|
|
342
|
-
[@-Z\\-_]
|
|
343
|
-
| # or [ for CSI, followed by a control sequence
|
|
344
|
-
\[
|
|
345
|
-
[0-?]* # Parameter bytes
|
|
346
|
-
[ -/]* # Intermediate bytes
|
|
347
|
-
[@-~] # Final byte
|
|
348
|
-
)
|
|
349
|
-
""",
|
|
350
|
-
re.VERBOSE,
|
|
351
|
-
)
|
|
352
|
-
|
|
353
|
-
|
|
354
336
|
def _show_resources_diff(
|
|
355
337
|
diff: GraphDiff,
|
|
356
338
|
show_schema: bool,
|
|
@@ -412,9 +394,8 @@ def _show_create_resource_diff(
|
|
|
412
394
|
value = code_plan._create_resource_diff_object(
|
|
413
395
|
r, rewrites=rewrites, show_secrets=show_secrets
|
|
414
396
|
)
|
|
415
|
-
diff = classdiff.diff(a=value, b=None, class_key=class_key)
|
|
416
397
|
|
|
417
|
-
_show_diff(
|
|
398
|
+
_show_diff(None, value, color, diff_output, class_key)
|
|
418
399
|
|
|
419
400
|
|
|
420
401
|
def _show_delete_resource_diff(
|
|
@@ -433,9 +414,8 @@ def _show_delete_resource_diff(
|
|
|
433
414
|
value = code_plan._create_resource_diff_object(
|
|
434
415
|
r, rewrites=rewrites, show_secrets=show_secrets
|
|
435
416
|
)
|
|
436
|
-
diff = classdiff.diff(a=None, b=value, class_key=class_key)
|
|
437
417
|
|
|
438
|
-
_show_diff(
|
|
418
|
+
_show_diff(value, None, color, diff_output, class_key)
|
|
439
419
|
|
|
440
420
|
|
|
441
421
|
def _show_update_resource_diff(
|
|
@@ -457,34 +437,34 @@ def _show_update_resource_diff(
|
|
|
457
437
|
b_value = code_plan._create_resource_diff_object(
|
|
458
438
|
r.server.resource, show_secrets=show_secrets, rewrites=rewrites
|
|
459
439
|
)
|
|
460
|
-
diff = classdiff.diff(a=a_value, b=b_value, class_key=class_key)
|
|
461
440
|
|
|
462
|
-
_show_diff(
|
|
441
|
+
_show_diff(b_value, a_value, color, diff_output, class_key)
|
|
463
442
|
|
|
464
443
|
|
|
465
|
-
def _show_diff(
|
|
444
|
+
def _show_diff(
|
|
445
|
+
current_value: Any,
|
|
446
|
+
new_value: Any,
|
|
447
|
+
color: bool,
|
|
448
|
+
diff_output: DiffOutput,
|
|
449
|
+
class_key: str | None = None,
|
|
450
|
+
) -> None:
|
|
466
451
|
if diff_output == DiffOutput.NONE:
|
|
467
452
|
return
|
|
468
453
|
|
|
454
|
+
diff = classdiff.diff(
|
|
455
|
+
current_value,
|
|
456
|
+
new_value,
|
|
457
|
+
no_color=not color,
|
|
458
|
+
changes_only=diff_output == DiffOutput.CHANGES,
|
|
459
|
+
object_name=class_key,
|
|
460
|
+
)
|
|
461
|
+
|
|
462
|
+
print(diff)
|
|
463
|
+
|
|
469
464
|
# We keep track if any lines were printed at all (any changes or full
|
|
470
465
|
# output) and if not we don't add a newline. This is to make it more
|
|
471
466
|
# condensed and consistent with the DiffOutput.NONE output.
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
for diff_info in diff:
|
|
475
|
-
if (
|
|
476
|
-
diff_output == DiffOutput.CHANGES
|
|
477
|
-
and diff_info.diff_type == classdiff.DiffType.UNCHANGED
|
|
478
|
-
):
|
|
479
|
-
continue
|
|
480
|
-
|
|
481
|
-
any_lines_printed = True
|
|
482
|
-
line = str(diff_info)
|
|
483
|
-
if not color:
|
|
484
|
-
line = ansi_escape.sub("", line)
|
|
485
|
-
print(f"{line}")
|
|
486
|
-
|
|
487
|
-
if any_lines_printed:
|
|
467
|
+
if diff:
|
|
488
468
|
print()
|
|
489
469
|
|
|
490
470
|
|
|
@@ -15,6 +15,7 @@ from validio_sdk.graphql_client.input_types import (
|
|
|
15
15
|
AwsRedshiftInferSchemaInput,
|
|
16
16
|
AwsS3InferSchemaInput,
|
|
17
17
|
CsvParserInput,
|
|
18
|
+
DatabricksInferSchemaInput,
|
|
18
19
|
GcpBigQueryInferSchemaInput,
|
|
19
20
|
GcpPubSubInferSchemaInput,
|
|
20
21
|
GcpPubSubLiteInferSchemaInput,
|
|
@@ -258,6 +259,7 @@ async def _interactive(config_dir: str, filename: Path, namespace: str) -> None:
|
|
|
258
259
|
("kinesis", "Amazon Kinesis"),
|
|
259
260
|
("s3", "Amazon S3"),
|
|
260
261
|
],
|
|
262
|
+
"DatabricksCredential": [("databricks", "Databricks")],
|
|
261
263
|
"DemoCredential": [("demo", "Demo")],
|
|
262
264
|
"GcpCredential": [
|
|
263
265
|
("bigquery", "Google BigQuery"),
|
|
@@ -288,6 +290,20 @@ async def _interactive(config_dir: str, filename: Path, namespace: str) -> None:
|
|
|
288
290
|
return
|
|
289
291
|
|
|
290
292
|
match inference_type:
|
|
293
|
+
case "databricks":
|
|
294
|
+
info = await _multip_prompt([
|
|
295
|
+
("Catalog", [], ""),
|
|
296
|
+
("Schema", [], ""),
|
|
297
|
+
("Table", [], ""),
|
|
298
|
+
])
|
|
299
|
+
await _infer_schema_databricks(
|
|
300
|
+
vc,
|
|
301
|
+
filename,
|
|
302
|
+
credential_id,
|
|
303
|
+
info.get("catalog", ""),
|
|
304
|
+
info.get("schema", ""),
|
|
305
|
+
info.get("table", ""),
|
|
306
|
+
)
|
|
291
307
|
case "demo":
|
|
292
308
|
await _infer_schema_demo(vc, filename)
|
|
293
309
|
case "kinesis":
|
|
@@ -815,6 +831,26 @@ async def gcs(
|
|
|
815
831
|
)
|
|
816
832
|
|
|
817
833
|
|
|
834
|
+
async def _infer_schema_databricks(
|
|
835
|
+
vc: ValidioAPIClient,
|
|
836
|
+
filename: Path,
|
|
837
|
+
credential_id: str,
|
|
838
|
+
catalog: str,
|
|
839
|
+
db_schema: str,
|
|
840
|
+
table: str,
|
|
841
|
+
) -> None:
|
|
842
|
+
schema = await vc.infer_databricks_schema(
|
|
843
|
+
DatabricksInferSchemaInput(
|
|
844
|
+
credential_id=credential_id,
|
|
845
|
+
http_path="",
|
|
846
|
+
catalog=catalog,
|
|
847
|
+
db_schema=db_schema,
|
|
848
|
+
table=table,
|
|
849
|
+
)
|
|
850
|
+
)
|
|
851
|
+
_write_schema(filename, schema)
|
|
852
|
+
|
|
853
|
+
|
|
818
854
|
async def _infer_schema_demo(
|
|
819
855
|
vc: ValidioAPIClient,
|
|
820
856
|
filename: Path,
|
|
@@ -1155,9 +1191,9 @@ async def _resolve_credential(
|
|
|
1155
1191
|
def _get_message_format_input(
|
|
1156
1192
|
message_format: str | None, message_schema: str | None
|
|
1157
1193
|
) -> StreamingSourceMessageFormatConfigInput | None:
|
|
1158
|
-
if any([message_format, message_schema]) and not all(
|
|
1159
|
-
message_format, message_schema
|
|
1160
|
-
|
|
1194
|
+
if any([message_format, message_schema]) and not all(
|
|
1195
|
+
[message_format, message_schema]
|
|
1196
|
+
):
|
|
1161
1197
|
raise ValidioError(
|
|
1162
1198
|
"Both message_format and message_schema must be supplied, or neither them"
|
|
1163
1199
|
)
|
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import os
|
|
2
|
+
import shutil
|
|
3
|
+
import sys
|
|
4
|
+
from typing import Optional
|
|
5
|
+
|
|
6
|
+
import typer
|
|
7
|
+
import validio_sdk.metadata
|
|
8
|
+
from tabulate import tabulate
|
|
9
|
+
from validio_sdk import ValidioError
|
|
10
|
+
from validio_sdk.config import Config
|
|
11
|
+
|
|
12
|
+
import validio_cli.metadata
|
|
13
|
+
from validio_cli.bin.entities import (
|
|
14
|
+
channels,
|
|
15
|
+
code,
|
|
16
|
+
config,
|
|
17
|
+
credentials,
|
|
18
|
+
dbt,
|
|
19
|
+
incidents,
|
|
20
|
+
metrics,
|
|
21
|
+
notification_rules,
|
|
22
|
+
recommendations,
|
|
23
|
+
resources,
|
|
24
|
+
segmentations,
|
|
25
|
+
segments,
|
|
26
|
+
sources,
|
|
27
|
+
users,
|
|
28
|
+
validators,
|
|
29
|
+
windows,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
app = typer.Typer(
|
|
33
|
+
help="Validio CLI tool",
|
|
34
|
+
no_args_is_help=True,
|
|
35
|
+
pretty_exceptions_enable=False,
|
|
36
|
+
rich_markup_mode="rich",
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
app.add_typer(channels.app, no_args_is_help=True, name="channels")
|
|
40
|
+
app.add_typer(code.app, no_args_is_help=True, name="code")
|
|
41
|
+
app.add_typer(config.app, no_args_is_help=True, name="config")
|
|
42
|
+
app.add_typer(credentials.app, no_args_is_help=True, name="credentials")
|
|
43
|
+
app.add_typer(dbt.app, no_args_is_help=True, name="dbt")
|
|
44
|
+
app.add_typer(incidents.app, no_args_is_help=True, name="incidents")
|
|
45
|
+
app.add_typer(metrics.app, no_args_is_help=True, name="metrics")
|
|
46
|
+
app.add_typer(resources.app, no_args_is_help=True, name="resources")
|
|
47
|
+
app.add_typer(notification_rules.app, no_args_is_help=True, name="notification-rules")
|
|
48
|
+
app.add_typer(recommendations.app, no_args_is_help=True, name="recommendations")
|
|
49
|
+
app.add_typer(segmentations.app, no_args_is_help=True, name="segmentations")
|
|
50
|
+
app.add_typer(segments.app, no_args_is_help=True, name="segments")
|
|
51
|
+
app.add_typer(sources.app, no_args_is_help=True, name="sources")
|
|
52
|
+
app.add_typer(users.app, no_args_is_help=True, name="users")
|
|
53
|
+
app.add_typer(validators.app, no_args_is_help=True, name="validators")
|
|
54
|
+
app.add_typer(windows.app, no_args_is_help=True, name="windows")
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
@app.command(help="Show current version")
|
|
58
|
+
def version() -> None:
|
|
59
|
+
print(
|
|
60
|
+
tabulate(
|
|
61
|
+
[
|
|
62
|
+
["SDK version", validio_sdk.metadata.version()],
|
|
63
|
+
["CLI version", validio_cli.metadata.version()],
|
|
64
|
+
],
|
|
65
|
+
tablefmt="plain",
|
|
66
|
+
)
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
@app.command(
|
|
71
|
+
add_help_option=False,
|
|
72
|
+
context_settings={"allow_extra_args": True, "ignore_unknown_options": True},
|
|
73
|
+
)
|
|
74
|
+
def plugins(
|
|
75
|
+
ctx: typer.Context,
|
|
76
|
+
# We need to keep this for typer
|
|
77
|
+
# ruff: noqa: UP007
|
|
78
|
+
plugin: Optional[str] = typer.Argument(
|
|
79
|
+
None,
|
|
80
|
+
help="Plugin to run. Leave empty to list available plugins.",
|
|
81
|
+
),
|
|
82
|
+
) -> None:
|
|
83
|
+
"""
|
|
84
|
+
Run plugin.
|
|
85
|
+
|
|
86
|
+
This works similar to `git` in that any executable prefixed with `validio-`
|
|
87
|
+
will be executed through this CLI without the prefix. That means that if you
|
|
88
|
+
have an executable somewhere in your `PATH` named `validio-my-app` you can
|
|
89
|
+
invoke that by running `validio plugin my-app`.
|
|
90
|
+
|
|
91
|
+
Any additional arguments will be passed to your plugin so you can run
|
|
92
|
+
`validio plugin my-app --arg1 --arg2`.
|
|
93
|
+
"""
|
|
94
|
+
# We allow plugin as None since we want to show all available plugins when
|
|
95
|
+
# this part is
|
|
96
|
+
if plugin is None:
|
|
97
|
+
_list_executables()
|
|
98
|
+
return
|
|
99
|
+
|
|
100
|
+
# Since we want to allow passing any argument to plugins we accept extra
|
|
101
|
+
# unknown arguments and remove the `--help` flag so it can be passed to the
|
|
102
|
+
# plugin. However, if the _only_ argument passed (i.e. the `plugin`) is help
|
|
103
|
+
# we assume that the user wants help about the `plugin` subcommand.
|
|
104
|
+
if plugin in ["-h", "--help"]:
|
|
105
|
+
typer.echo(ctx.get_help())
|
|
106
|
+
return
|
|
107
|
+
|
|
108
|
+
plugin_path = shutil.which(f"validio-{plugin}")
|
|
109
|
+
if not plugin_path:
|
|
110
|
+
raise ValidioError(f"Unknown plugin {plugin}")
|
|
111
|
+
|
|
112
|
+
cfg = Config(None)
|
|
113
|
+
validio_cfg = cfg.read()
|
|
114
|
+
|
|
115
|
+
os.execve(
|
|
116
|
+
plugin_path,
|
|
117
|
+
[plugin_path] + sys.argv[3:],
|
|
118
|
+
# If someone wants to write a plugin with tooling that doesn't have an
|
|
119
|
+
# SDK we kindly pass the credentials to the environment so you can
|
|
120
|
+
# easily call Validio anyway.
|
|
121
|
+
{
|
|
122
|
+
"VALIDIO_CONFIG_PATH": str(cfg.config_path),
|
|
123
|
+
"VALIDIO_ENDPOINT": validio_cfg.endpoint,
|
|
124
|
+
"VALIDIO_ACCESS_KEY_ENV": validio_cfg.access_key,
|
|
125
|
+
"VALIDIO_SECRET_ACCESS_KEY_ENV": validio_cfg._access_secret,
|
|
126
|
+
},
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
def _list_executables() -> None:
|
|
131
|
+
paths = os.environ.get("PATH", "").split(":")
|
|
132
|
+
|
|
133
|
+
executables = set()
|
|
134
|
+
for path in paths:
|
|
135
|
+
try:
|
|
136
|
+
executables.update({
|
|
137
|
+
filename.lstrip("validio-")
|
|
138
|
+
for filename in os.listdir(path)
|
|
139
|
+
if filename.startswith("validio-")
|
|
140
|
+
})
|
|
141
|
+
except FileNotFoundError:
|
|
142
|
+
continue
|
|
143
|
+
|
|
144
|
+
if not executables:
|
|
145
|
+
print("No plugins found")
|
|
146
|
+
return
|
|
147
|
+
|
|
148
|
+
print(
|
|
149
|
+
tabulate(
|
|
150
|
+
[[executable] for executable in executables],
|
|
151
|
+
tablefmt="plain",
|
|
152
|
+
headers=["PLUGIN NAME"],
|
|
153
|
+
)
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
def main() -> None:
|
|
158
|
+
exit_code = 1
|
|
159
|
+
|
|
160
|
+
try:
|
|
161
|
+
app()
|
|
162
|
+
exit_code = 0
|
|
163
|
+
|
|
164
|
+
# If the pipe is broken we can't print more so just return asap.
|
|
165
|
+
except BrokenPipeError:
|
|
166
|
+
return
|
|
167
|
+
|
|
168
|
+
# ValidioErrors are thrown by us and should not require the stack trace
|
|
169
|
+
# to tell what went wrong.
|
|
170
|
+
except ValidioError as e:
|
|
171
|
+
print(f"Something went wrong: {e}")
|
|
172
|
+
|
|
173
|
+
sys.exit(exit_code)
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
if __name__ == "__main__":
|
|
177
|
+
main()
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
import sys
|
|
2
|
-
|
|
3
|
-
import typer
|
|
4
|
-
import validio_sdk.metadata
|
|
5
|
-
from tabulate import tabulate
|
|
6
|
-
from validio_sdk import ValidioError
|
|
7
|
-
|
|
8
|
-
import validio_cli.metadata
|
|
9
|
-
from validio_cli.bin.entities import (
|
|
10
|
-
channels,
|
|
11
|
-
code,
|
|
12
|
-
config,
|
|
13
|
-
credentials,
|
|
14
|
-
dbt,
|
|
15
|
-
incidents,
|
|
16
|
-
metrics,
|
|
17
|
-
notification_rules,
|
|
18
|
-
recommendations,
|
|
19
|
-
resources,
|
|
20
|
-
segmentations,
|
|
21
|
-
segments,
|
|
22
|
-
sources,
|
|
23
|
-
users,
|
|
24
|
-
validators,
|
|
25
|
-
windows,
|
|
26
|
-
)
|
|
27
|
-
|
|
28
|
-
app = typer.Typer(
|
|
29
|
-
help="Validio CLI tool", no_args_is_help=True, pretty_exceptions_enable=False
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
app.add_typer(channels.app, no_args_is_help=True, name="channels")
|
|
33
|
-
app.add_typer(code.app, no_args_is_help=True, name="code")
|
|
34
|
-
app.add_typer(config.app, no_args_is_help=True, name="config")
|
|
35
|
-
app.add_typer(credentials.app, no_args_is_help=True, name="credentials")
|
|
36
|
-
app.add_typer(dbt.app, no_args_is_help=True, name="dbt")
|
|
37
|
-
app.add_typer(incidents.app, no_args_is_help=True, name="incidents")
|
|
38
|
-
app.add_typer(metrics.app, no_args_is_help=True, name="metrics")
|
|
39
|
-
app.add_typer(resources.app, no_args_is_help=True, name="resources")
|
|
40
|
-
app.add_typer(notification_rules.app, no_args_is_help=True, name="notification-rules")
|
|
41
|
-
app.add_typer(recommendations.app, no_args_is_help=True, name="recommendations")
|
|
42
|
-
app.add_typer(segmentations.app, no_args_is_help=True, name="segmentations")
|
|
43
|
-
app.add_typer(segments.app, no_args_is_help=True, name="segments")
|
|
44
|
-
app.add_typer(sources.app, no_args_is_help=True, name="sources")
|
|
45
|
-
app.add_typer(users.app, no_args_is_help=True, name="users")
|
|
46
|
-
app.add_typer(validators.app, no_args_is_help=True, name="validators")
|
|
47
|
-
app.add_typer(windows.app, no_args_is_help=True, name="windows")
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
@app.command(help="Show current version")
|
|
51
|
-
def version() -> None:
|
|
52
|
-
print(
|
|
53
|
-
tabulate(
|
|
54
|
-
[
|
|
55
|
-
["SDK version", validio_sdk.metadata.version()],
|
|
56
|
-
["CLI version", validio_cli.metadata.version()],
|
|
57
|
-
],
|
|
58
|
-
tablefmt="plain",
|
|
59
|
-
)
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
def main() -> None:
|
|
64
|
-
exit_code = 1
|
|
65
|
-
|
|
66
|
-
try:
|
|
67
|
-
app()
|
|
68
|
-
exit_code = 0
|
|
69
|
-
|
|
70
|
-
# If the pipe is broken we can't print more so just return asap.
|
|
71
|
-
except BrokenPipeError:
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
# ValidioErrors are thrown by us and should not require the stack trace
|
|
75
|
-
# to tell what went wrong.
|
|
76
|
-
except ValidioError as e:
|
|
77
|
-
print(f"Something went wrong: {e}")
|
|
78
|
-
|
|
79
|
-
sys.exit(exit_code)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
if __name__ == "__main__":
|
|
83
|
-
main()
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|