forked from EVOLVED-5G/SDK-CLI
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
55 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,42 +1,67 @@ | ||
"""Console script for evolved5g.""" | ||
import click | ||
from .utils import cookiecutter_generate | ||
from evolved5g.cli_helper import CLI_helper | ||
import os | ||
|
||
|
||
@click.command() | ||
def main(args=None): | ||
"""Console script for evolved5g.""" | ||
click.echo( | ||
"The console script for Evolved5G, this messages comes from evolved5g.cli.main") | ||
click.echo("See click documentation at https://click.palletsprojects.com/") | ||
return 0 | ||
|
||
# Creating Command group | ||
|
||
|
||
@click.group() | ||
@click.version_option() | ||
@click.pass_context | ||
def cli(ctx): | ||
def cli(): | ||
"""Console interface for EVOLVED-5G H2020 project""" | ||
ctx.ensure_object(dict) | ||
ctx.obj["helper"] = CLI_helper() | ||
pass | ||
|
||
|
||
@cli.command() | ||
@click.command() | ||
@click.option('--no-input', type=bool, is_flag=True, | ||
help='Enables no prompt from the CLI during template generation', default=False) | ||
@click.option('-r', '--repo-name', type=str, help='Enter Repository name') | ||
@click.option('-p', '--package-name', type=str, help='Enter package name') | ||
@click.option('-t', '--template', type=str, help="Provide template location for custom package") | ||
@click.pass_context | ||
def generate(ctx,no_input, repo_name, package_name, template): | ||
def generate(no_input, repo_name, package_name, template): | ||
"""Generate EVOLVED-5G compliant NetApp from template""" | ||
ctx.obj["helper"].generate(no_input, repo_name, package_name, template) | ||
|
||
@cli.command() | ||
@click.option('--mode',type=click.Choice(['build', 'deploy','destroy'], case_sensitive=False)) | ||
@click.option('--repo',type=str, help='Enter repo name') | ||
@click.pass_context | ||
def run_pipeline(ctx, mode, repo): | ||
""" | ||
""" | ||
ctx.obj["helper"].run_pipeline(mode,repo) | ||
|
||
@cli.command() | ||
@click.option('--id',type=int, help='Enter pipeline id') | ||
@click.pass_context | ||
def check_pipeline(ctx, id): | ||
""" | ||
""" | ||
ctx.obj["helper"].check_pipeline(id) | ||
# __location__ = os.path.realpath(os.path.join( | ||
# os.getcwd(), os.path.dirname(__file__), "..")) | ||
# location = (__location__ + '/cookiecutter_template/') | ||
# click.echo(__location__) # -- for debug | ||
extra = {} | ||
if repo_name: | ||
extra['repoName'] = repo_name | ||
if package_name: | ||
extra['packageName'] = package_name | ||
if template: | ||
cookiecutter_generate(template,no_input=no_input,extra_context=extra) | ||
return | ||
location = "gh:EVOLVED-5G/template" # location to github package | ||
# Create project from the github package template | ||
cookiecutter_generate(location, no_input=no_input, extra_context=extra) | ||
|
||
|
||
# @click.command() | ||
# def connect(): | ||
# """Connect repository to CI/CD""" | ||
# # Connect repository to CI/CD TODO | ||
# click.echo("Connecting Repo to CI/CD") | ||
|
||
# @click.command() | ||
# @click.option('-r', '--repeat', type=int, help='times to repeat', default=1) | ||
# @click.option('-n', '--name', type=str, help='Name to greet', default='World') | ||
# def test(repeat, name): | ||
# """For Testing purposes, TODO Delete""" | ||
# for i in range(repeat): | ||
# click.echo(f'Hello {name}. This is a test') | ||
|
||
#cli.add_command(test) | ||
# cli.add_command(connect) | ||
|
||
cli.add_command(generate) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,3 @@ twine | |
Click==8.0.1 | ||
pytest==6.2.4 | ||
cookiecutter==1.7.3 | ||
invoke==1.6.0 | ||
requests==2.26.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters