python-click/examples/complex/complex/commands/cmd_init.py

14 lines
385 B
Python
Raw Normal View History

2020-07-21 08:23:42 +02:00
from complex.cli import pass_environment
2014-10-16 20:40:34 +02:00
import click
2020-07-21 08:23:42 +02:00
@click.command("init", short_help="Initializes a repo.")
@click.argument("path", required=False, type=click.Path(resolve_path=True))
@pass_environment
2014-10-16 20:40:34 +02:00
def cli(ctx, path):
"""Initializes a repository."""
if path is None:
path = ctx.home
2021-10-10 03:31:57 +02:00
ctx.log(f"Initialized the repository in {click.format_filename(path)}")