Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nebari typer cli commands #1432

Merged
merged 4 commits into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 33 additions & 5 deletions qhub/cli/main.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import pathlib

import typer
from click import Context
from typer.core import TyperGroup

from qhub.cli._init import check_cloud_provider_creds
from qhub.schema import ProviderEnum
from qhub.schema import ProviderEnum, verify
from qhub.utils import load_yaml


def enum_to_list(enum_cls):
Expand Down Expand Up @@ -82,26 +85,51 @@ def init(
),
):
"""
Initialize the nebari-config.yaml file.
Initialize nebari-config.yaml file.

"""


@app.command()
def validate():
def validate(
config: str = typer.Option(
None,
"--config",
"-c",
help="qhub configuration yaml file path, please pass in as -c/--config flag",
),
enable_commenting: bool = typer.Option(
False, "--enable_commenting", help="Toggle PR commenting on GitHub Actions"
),
):
"""
Validate the config.yaml file.

"""
print("Validate the config.yaml file")
# print(f"Validate the {config}")

config_filename = pathlib.Path(config)
if not config_filename.is_file():
raise ValueError(
f"Passed in configuration filename={config_filename} must exist."
)

config = load_yaml(config_filename)

if enable_commenting:
# for PR's only
# comment_on_pr(config)
pass
else:
verify(config)
print("Successfully validated configuration")


@app.command()
def render():
"""
Render the config.yaml file.
"""
print("Render the congig.yaml file")


@app.command()
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ dev =
[options.entry_points]
console_scripts =
qhub = qhub.__main__:main
nebari = qhub.cli.main.__main__
nebari = qhub.cli.main:app
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch!


[tool:pytest]
norecursedirs = _build .nox .ipynb_checkpoints
Expand Down