Skip to content

Commit

Permalink
v0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bsdlp committed Aug 4, 2014
1 parent 84a9307 commit e5d586a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions yaurtww/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""yaurtww.
Usage:
yaurtww <filename>
yaurtww <filename> --dest=<target>
yaurtww (-h | --help)
yaurtww --version
Expand All @@ -26,21 +26,24 @@
from .manifest import Manifest
from contextlib import closing
from docopt import docopt
from os import getcwd
from os.path import abspath, expanduser
import grequests


def main():
_default_dir = ''.join([getcwd(), 'q3ut4/'])
arguments = docopt(__doc__, version=__version__)
if arguments['--version']:
print("yaurtww {0}".format(__version__))
return

if arguments['<filename>']:
_target = arguments['--dest'] if arguments['--dest'] else _default_dir
manifest_file = abspath(expanduser(arguments['<filename>']))
manifest = Manifest(manifest_file)
for asset in manifest.files:
_target_file = asset.url.split('/')[-1]
with closing(asset) as content:
with open(''.join(['q3ut4/', _target_file]), 'w') as f:
with open(''.join([_target, _target_file]), 'w') as f:
f.write(content)

0 comments on commit e5d586a

Please sign in to comment.