This commit is contained in:
2019-02-17 20:59:14 -05:00
parent 7f905f7f2f
commit 54e9b1dec9
2 changed files with 7 additions and 11 deletions

View File

@@ -2,12 +2,11 @@ from tatt import config
from tatt import vendors
def print_all_services(free_only=False, print_=True):
# TODO: make a jinja template for this
def make_string_all_services(free_only=False):
all_services_string = (
'\nHere are all the available ' +
f'{"free " if free_only else ""}speech-to-text services:' +
'\n\n' +
'\nHere are all the available '
f'{"free " if free_only else ""}speech-to-text services:'
'\n\n'
'\n'.join(['{}{}{}{}'.format('\t', service_name, '\t\t',
f'({info["free"].replace("_", " ")})'
@@ -17,14 +16,11 @@ def print_all_services(free_only=False, print_=True):
for service_name, info in
config.STT_SERVICES.items()])
+ '\n'
'\n'
)
if print_:
print(all_services_string)
return all_services_string
def get_service(service_name):
return getattr(getattr(vendors, service_name), config.SERVICE_CLASS_NAME)

View File

@@ -60,7 +60,7 @@ def list(name, service, status):
@click.option('-f', '--free-only', is_flag=True, help='only free services')
def services(free_only):
"""Lists available speech-to-text services."""
helpers.print_all_services(free_only)
click.echo(helpers.make_string_all_services(free_only))
@cli.command()