made output pipeable hopefully, added 'pretty' option for 'get' in CLI

This commit is contained in:
2019-02-20 12:52:39 -05:00
parent 8383e6ebb3
commit eaf0dc4cc3
2 changed files with 5 additions and 2 deletions

View File

@@ -6,7 +6,7 @@ with open('README.md') as file:
setup(
name="tatt",
version="0.953",
version="0.954",
py_modules=['tatt'],
url='https://github.com/zevaverbach/tatt',
install_requires=[

View File

@@ -15,11 +15,14 @@ def cli():
@cli.command()
@click.option('-s', '--save', is_flag=True, help='save to file')
@click.option('-p', '--pretty', is_flag=True,
help='pretty print, will make output non-pipeable')
@click.argument('name')
def get(name, save):
"""Downloads and/or saves completed transcript."""
try:
transcript = json.dumps(helpers.get_transcript(name), indent=4)
transcript = json.dumps(helpers.get_transcript(name),
indent=4 if pretty else None)
except exceptions.DoesntExistError:
raise click.ClickException(f'no such transcript {name}')
except exceptions.NotAvailable as e: