From 52e9256f9475585fe342ee61f5c484e11159a76a Mon Sep 17 00:00:00 2001 From: "Andreas H. Kelch" Date: Mon, 8 Nov 2021 10:58:07 +0100 Subject: [PATCH] feat: Version handling --- CHANGELOG.md | 7 +++++++ README.md | 40 ++++++++++++++++++++++++++++++++++++++-- setup.cfg | 2 +- src/viur_cli/cli.py | 8 +++++++- src/viur_cli/local.py | 7 +++++++ 5 files changed, 60 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e69de29..43deb20 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -0,0 +1,7 @@ +# Changelog + +This file documents any relevant changes. + +## [0.5.0] - 2021-11-08 + +- first release diff --git a/README.md b/README.md index e09e8ab..e9eab9b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,38 @@ -# viur-tools -ViUR related python tools +## ViUR-ClI + +The ViUR-Cli project allows the control of ViUR projects from one central location. + +### Installation + +use pip or pipenv to install this package + + ```sh + pip install viur-cli + ``` + +### Some Examples + + ```sh + viur-cli --help + viur-cli init + viur-cli run + viur-cli deploy + viur-cli index + viur-cli vi + viur-cli flare vi watch + viur-cli env + ``` + +### Dependencies + +The app server dependents on the following packages + +* [click](https://click.palletsprojects.com/) +* [app_server](https://github.com/XeoN-GHMB/app_server) +* [pipfile-requirements](https://github.com/frostming/pipfile-requirements) +* [watchgod](https://github.com/samuelcolvin/watchgod) +* [python-minifier](https://github.com/dflook/python-minifier) + +## License + +Distributed under the MIT License. See `LICENSE` for more information. diff --git a/setup.cfg b/setup.cfg index 1262eb2..9c7a634 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = viur_cli -version = 0.2.0 +version = viur_cli.__version__ author = Andreas H. Kelch author_email = ak@mausbrand.de description = A CLI to do everyday tasks diff --git a/src/viur_cli/cli.py b/src/viur_cli/cli.py index c510726..568cd88 100644 --- a/src/viur_cli/cli.py +++ b/src/viur_cli/cli.py @@ -3,10 +3,16 @@ projectConfig = None projectConfigFilePath = "./project.json" +__version__ = "0.5.0" + @click.group(invoke_without_command=True) -def cli(): +@click.option("-v", "--version", is_flag=True) +def cli(version): """Info output""" + if version: + click.echo(f"ViUR-CLI {__version__}") + return 0 click.echo("Welcome to ViUR-CLI") loadConfig() diff --git a/src/viur_cli/local.py b/src/viur_cli/local.py index 89ce863..d3b469d 100644 --- a/src/viur_cli/local.py +++ b/src/viur_cli/local.py @@ -27,6 +27,13 @@ def env(): click.echo(f"Current Environment:") + # viur-cli + if shutil.which("viur-cli"): + app_server_version = subprocess.check_output(['viur-cli', '-v']).decode("utf-8") + click.echo(f"{valid_icon} {app_server_version}") + else: + click.echo(f"{failed_icon} ViUR-CLI") + # app_server if shutil.which("app_server"): app_server_version = subprocess.check_output(['app_server', '-V']).decode("utf-8")