2021-04-11 16:36:59 +02:00
|
|
|
import textwrap
|
|
|
|
|
2021-03-08 20:29:08 +01:00
|
|
|
from cpl_cli.command_abc import CommandABC
|
|
|
|
from cpl_cli.publish.publisher_abc import PublisherABC
|
|
|
|
|
|
|
|
|
2021-03-12 16:06:30 +01:00
|
|
|
class PublishService(CommandABC):
|
2021-03-08 20:29:08 +01:00
|
|
|
|
|
|
|
def __init__(self, publisher: PublisherABC):
|
2021-03-14 16:01:15 +01:00
|
|
|
"""
|
|
|
|
Service for the CLI command publish
|
|
|
|
:param publisher:
|
|
|
|
"""
|
2021-03-08 20:29:08 +01:00
|
|
|
CommandABC.__init__(self)
|
|
|
|
|
|
|
|
self._publisher = publisher
|
|
|
|
|
2021-04-11 16:36:59 +02:00
|
|
|
@property
|
|
|
|
def help_message(self) -> str:
|
|
|
|
return textwrap.dedent("""\
|
2021-04-12 20:02:45 +02:00
|
|
|
Prepares files for publish into an output directory named dist/ at the given output path and executes setup.py.
|
2021-04-12 20:05:55 +02:00
|
|
|
Usage: cpl publish
|
2021-04-11 16:36:59 +02:00
|
|
|
""")
|
|
|
|
|
2022-05-22 18:33:07 +02:00
|
|
|
def execute(self, args: list[str]):
|
2021-03-14 16:01:15 +01:00
|
|
|
"""
|
|
|
|
Entry point of command
|
|
|
|
:param args:
|
|
|
|
:return:
|
|
|
|
"""
|
2021-03-08 20:29:08 +01:00
|
|
|
self._publisher.publish()
|