Skip to content

Commit

Permalink
fix: errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sujuka99 committed Dec 21, 2023
1 parent 8c0363e commit 782481f
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 21 deletions.
20 changes: 20 additions & 0 deletions docs/docs/user/references/cli-commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ $ kpops [OPTIONS] COMMAND [ARGS]...
* `deploy`: Deploy pipeline steps
* `destroy`: Destroy pipeline steps
* `generate`: Enriches pipelines steps with defaults.
* `init`: Create a new a KPOps project.
* `reset`: Reset pipeline steps
* `schema`: Generate json schema.

Expand Down Expand Up @@ -134,6 +135,25 @@ $ kpops generate [OPTIONS] PIPELINE_PATH [COMPONENTS_MODULE]
* `--environment TEXT`: The environment you want to generate and deploy the pipeline to. Suffix your environment files with this value (e.g. defaults_development.yaml for environment=development). [env var: KPOPS_ENVIRONMENT]
* `--help`: Show this message and exit.

## `kpops init`

Create a new a KPOps project.

**Usage**:

```console
$ kpops init [OPTIONS] PATH
```

**Arguments**:

* `PATH`: Path for a new KPOps project. [required]

**Options**:

* `--name TEXT`: Name of the new KPOps project. A new directory with the provided name will be created. Leave empty to use the existing dir provided via `--path`.
* `--help`: Show this message and exit.

## `kpops reset`

Reset pipeline steps
Expand Down
24 changes: 9 additions & 15 deletions kpops/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
import dtyper
import typer

from hooks.gen_docs.gen_docs_env_vars import collect_fields
from kpops import __version__
from kpops.cli.custom_formatter import CustomFormatter
from kpops.cli.registry import Registry
Expand Down Expand Up @@ -259,20 +258,15 @@ def init(
path: Path = PROJECT_PATH,
name: Optional[str] = PROJECT_NAME,
):
...
# if name:
# path = path / name
# elif next(path.iterdir(), False):
# log.warning("Please provide a path to an empty directory.")
# return
# config_fields = collect_fields(PipelineConfig)
# path.mkdir(exist_ok=True)
# pipeline_name = "pipeline"
# defaults_name = "defaults"
# config_name = "config"
# for file_name in [pipeline_name, defaults_name, config_name]:
# file_name = file_name + ".yaml"
# Path(path / file_name).touch(exist_ok=False)
if name:
path = path / name
elif next(path.iterdir(), False):
log.warning("Please provide a path to an empty directory.")
return
path.mkdir(exist_ok=True)
pipeline_name = "pipeline"

Check failure on line 267 in kpops/cli/main.py

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, 3.10)

Local variable `pipeline_name` is assigned to but never used
defaults_name = "defaults"

Check failure on line 268 in kpops/cli/main.py

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, 3.10)

Local variable `defaults_name` is assigned to but never used
config_name = "config"

Check failure on line 269 in kpops/cli/main.py

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, 3.10)

Local variable `config_name` is assigned to but never used


@app.command( # pyright: ignore[reportGeneralTypeIssues] https://github.com/rec/dtyper/issues/8
Expand Down
14 changes: 8 additions & 6 deletions kpops/utils/cli_commands.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,28 @@

import logging
from pathlib import Path
from hooks.gen_docs.gen_docs_env_vars import collect_fields

from kpops.cli.pipeline_config import PipelineConfig
from hooks.gen_docs.gen_docs_env_vars import collect_fields
from kpops.config import KpopsConfig

log = logging.getLogger("cli_commands_utils")



def touch_yaml_file(file_name, dir_path) -> Path:
file_path = Path(dir_path / (file_name + ".yaml"))
file_path.touch(exist_ok=False)
return file_path


def create_config(file_name: str, dir_path: Path) -> None:
file_path = touch_yaml_file(file_name, dir_path)
config_fields = collect_fields(PipelineConfig)
config_fields = collect_fields(KpopsConfig)

Check failure on line 18 in kpops/utils/cli_commands.py

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, 3.10)

Local variable `config_fields` is assigned to but never used
with file_path.open(mode="w"):

...


def create_defaults(file_name: str, dir_path: Path) -> None:
file_path = touch_yaml_file(file_name, dir_path)

Check failure on line 24 in kpops/utils/cli_commands.py

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, 3.10)

Local variable `file_path` is assigned to but never used


def create_pipeline(file_name: str, dir_path: Path) -> None:
file_path = touch_yaml_file(file_name, dir_path)

Check failure on line 28 in kpops/utils/cli_commands.py

View workflow job for this annotation

GitHub Actions / Test (ubuntu-22.04, 3.10)

Local variable `file_path` is assigned to but never used

0 comments on commit 782481f

Please sign in to comment.