Skip to content

Commit

Permalink
Flask CLI command to compare an environment file with sample.env (#1822)
Browse files Browse the repository at this point in the history
  • Loading branch information
miteshashar committed Jul 27, 2023
1 parent 7672b97 commit 1a3009a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions funnel/cli/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

from __future__ import annotations

from pathlib import Path
from typing import Any, Dict

import click
from dotenv import dotenv_values

from baseframe import baseframe_translations

Expand Down Expand Up @@ -45,3 +47,13 @@ def dbcreate() -> None:
def baseframe_translations_path() -> None:
"""Show path to Baseframe translations."""
click.echo(list(baseframe_translations.translation_directories)[0])


@app.cli.command('checkenv')
@click.argument('file', type=click.Path(exists=True, path_type=Path), default='.env')
def check_env(file: Path) -> None:
"""Compare environment file with sample.env and lists variables that do not exist."""
env = dotenv_values(file)
for var in dotenv_values('sample.env'):
if var not in env:
click.echo(var + ' does not exist')

0 comments on commit 1a3009a

Please sign in to comment.