Passed
Pull Request — master (#6)
by Komail
01:03
created

{{cookiecutter.project_slug}}.cli.main   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 15
dl 0
loc 39
rs 10
c 0
b 0
f 0

3 Functions

Rating   Name   Duplication   Size   Complexity  
A run() 0 6 1
A cli() 0 6 1
A version() 0 6 1
1
"""
2
This module holds the console script argument schema for the main script of
3
{{ cookiecutter.project_slug }} which can be invoked by {{ cookiecutter.project_slug.replace('_', '-') }}
4
"""
5
import platform
6
import sys
7
import click
8
9
from .. import __version__
10
11
12
def cli():
13
    """
14
    Main CLI interface exposed to the cli module and exposed to the console
15
    script.
16
    """
17
    click.echo(f"Calling {sys.argv[0]}")
18
19
20
@click.command()
21
def run():
22
    """
23
    The function that gets invoked by the subcommand "run"
24
    """
25
    click.echo('Running the script')
26
27
28
@click.command()
29
def version():
30
    """
31
    The function that gets invoked by the subcommand "version"
32
    """
33
    click.echo(f"Python {platform.python_version()}\n"
34
               f"{{ cookiecutter.project_slug }} {__version__}")
35
36
37
cli.add_command(run)  # pylint: disable=no-member
38
cli.add_command(version)  # pylint: disable=no-member
39