using click.echo's built in file-handling
This commit is contained in:
2
setup.py
2
setup.py
@@ -6,7 +6,7 @@ with open('README.md') as file:
|
||||
|
||||
setup(
|
||||
name="tatt",
|
||||
version="0.949",
|
||||
version="0.950",
|
||||
py_modules=['tatt'],
|
||||
url='https://github.com/zevaverbach/tatt',
|
||||
install_requires=[
|
||||
|
||||
@@ -25,12 +25,11 @@ def get(name, save):
|
||||
except exceptions.NotAvailable as e:
|
||||
raise click.ClickException(str(e))
|
||||
|
||||
if not save:
|
||||
click.echo(transcript)
|
||||
else:
|
||||
with open(f'{name}.json', 'w') as fout:
|
||||
fout.write(transcript)
|
||||
click.echo(f'Okay, downloaded {name}.json')
|
||||
filepath = None
|
||||
if save:
|
||||
filepath = f'{name}.json', 'w'
|
||||
|
||||
click.echo(transcript, file=filepath)
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user