Commit d78e2cfb authored by Tanguy Le Carrour's avatar Tanguy Le Carrour
Browse files

Add an `audio_editor` submodule to put the CLI code in.

parent c6ba8afc
......@@ -8,7 +8,7 @@ license = "GPL-3.0-or-later"
exclude = ["splito/**/*_spec.py", "splito/**/*_test.py", "splito/conftest.py"]
[tool.poetry.scripts]
splito = "splito.entry_points.cli:app"
splito = "splito.entry_points.cli:audio_editor"
[tool.poetry.dependencies]
python = "^3.8"
......
......@@ -3,7 +3,7 @@ import click
from splito.infrastructure.pydub.tracks import PydubTracks
def app() -> click.Group:
from splito.infrastructure.click import cli
def audio_editor() -> click.Group:
from splito.infrastructure.click.audio_editor import cli
return cli(obj={"tracks": PydubTracks()}) # type: ignore
import sys
from typing import Tuple
import click
import splito.interfaces.from_base_types as controllers
import splito.interfaces.to_terminal as presenters
from splito.use_cases.extract_sub_tracks import ExtractSubTracksInteractor
@click.group()
@click.pass_context
def cli(ctx: click.Context) -> None:
pass
@cli.command()
@click.pass_context
@click.argument("track")
@click.argument("intervals", nargs=-1)
def extract(ctx: click.Context, track: str, intervals: Tuple[str]) -> None:
controller = controllers.ExtractSubTracks(track, list(intervals))
presenter = presenters.ExtractSubTracks()
interactor = ExtractSubTracksInteractor(presenter, ctx.obj["tracks"])
controller.call(interactor)
click.echo(presenter.to_string())
sys.exit(presenter.exit_code())
import sys
from typing import Tuple
import click
import splito.interfaces.from_base_types as controllers
import splito.interfaces.to_terminal as presenters
from splito.use_cases.extract_sub_tracks import ExtractSubTracksInteractor
@click.group()
@click.pass_context
def cli(ctx: click.Context) -> None:
pass
@cli.command()
@click.pass_context
@click.argument("track")
@click.argument("intervals", nargs=-1)
def extract(ctx: click.Context, track: str, intervals: Tuple[str]) -> None:
controller = controllers.ExtractSubTracks(track, list(intervals))
presenter = presenters.ExtractSubTracks()
interactor = ExtractSubTracksInteractor(presenter, ctx.obj["tracks"])
controller.call(interactor)
click.echo(presenter.to_string())
sys.exit(presenter.exit_code())
from robber import expect # type: ignore
from splito.infrastructure.click import extract
from splito.infrastructure.click.audio_editor import extract
from splito.conftest import invoke
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment