Skip to content

Commit de07f9d

Browse files
committed
clean up cli module structure
1 parent 8892914 commit de07f9d

File tree

3 files changed

+83
-23
lines changed

3 files changed

+83
-23
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Copyright (c) 2025 Airbyte, Inc., all rights reserved.
2+
"""CLI commands for `airbyte-cdk`.
3+
4+
This CLI interface allows you to interact with your connector, including
5+
testing and running commands.
6+
7+
**Basic Usage:**
8+
9+
```bash
10+
airbyte-cdk --help
11+
airbyte-cdk connector --help
12+
airbyte-cdk manifest --help
13+
```
14+
15+
**Running Statelessly:**
16+
17+
You can run the latest version of this CLI, from any machine, using `pipx` or `uvx`:
18+
19+
```bash
20+
# Run the latest version of the CLI:
21+
pipx run airbyte-cdk connector --help
22+
uvx airbyte-cdk connector --help
23+
24+
# Run from a specific CDK version:
25+
pipx run airbyte-cdk==6.5.1 connector --help
26+
uvx airbyte-cdk==6.5.1 connector --help
27+
```
28+
29+
**Running within your virtualenv:**
30+
31+
You can also run from your connector's virtualenv:
32+
33+
```bash
34+
poetry run airbyte-cdk connector --help
35+
```
36+
37+
"""
38+
39+
from typing import cast
40+
41+
import click
42+
43+
from airbyte_cdk.cli.airbyte_cdk._connector import connector_cli_group
44+
from airbyte_cdk.cli.airbyte_cdk._manifest import manifest_cli_group
45+
46+
47+
@click.group(
48+
help=cast(str, __doc__).replace("\n", "\n\n"), # Workaround to format help text correctly
49+
)
50+
def cli() -> None:
51+
"""Airbyte CDK CLI.
52+
53+
Help text is provided from the file-level docstring.
54+
"""
55+
56+
57+
cli.add_command(connector_cli_group)
58+
cli.add_command(manifest_cli_group)
59+
60+
61+
if __name__ == "__main__":
62+
cli()
Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -85,17 +85,13 @@
8585
'''
8686

8787

88-
@click.group()
89-
def connector() -> None:
88+
@click.group(name="connector")
89+
def connector_cli_group() -> None:
9090
"""Connector related commands."""
9191
pass
9292

93-
@click.group()
94-
def manifest() -> None:
95-
"""Manifest related commands."""
96-
pass
9793

98-
@connector.command()
94+
@connector_cli_group.command()
9995
@click.option(
10096
"--connector-name",
10197
type=str,
@@ -184,20 +180,7 @@ def test(
184180
plugins=[],
185181
)
186182

187-
@click.group(
188-
help=USAGE.replace("\n", "\n\n"), # Workaround to format help text correctly
189-
)
190-
def cli() -> None:
191-
"""Airbyte CDK CLI.
192-
193-
Help text is provided from the file-level docstring.
194-
"""
195183

196-
cli.add_command(connector)
197-
cli.add_command(manifest)
198-
199-
def main() -> None:
200-
cli()
201-
202-
if __name__ == "__main__":
203-
main()
184+
__all__ = [
185+
"connector_cli_group",
186+
]
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright (c) 2025 Airbyte, Inc., all rights reserved.
2+
"""Manifest related commands."""
3+
4+
import click
5+
6+
7+
@click.group(name="manifest")
8+
def manifest_cli_group() -> None:
9+
"""Manifest related commands."""
10+
pass
11+
12+
13+
__all__ = [
14+
"manifest_cli_group",
15+
]

0 commit comments

Comments
 (0)