Skip to content

Commit

Permalink
Add --download and --url to make import a general downloader
Browse files Browse the repository at this point in the history
The import command can now be used as a general downloader by specifying "--download --url=http://... filename"
  • Loading branch information
kfsone committed Dec 17, 2014
1 parent c9667fa commit 7f5fc47
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions commands/import_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@
default=None,
),
),
ParseArgument('--url',
help='Name of the file to read.',
type=str,
default=None,
),
ParseArgument('--download',
help='Stop after downloading.',
action='store_true',
default=False,
),
ParseArgument(
'--ignore-unknown', '-i',
default=False, action='store_true',
Expand Down Expand Up @@ -89,6 +99,8 @@ def run(results, cmdenv, tdb):
if cmdenv.url:
cmdenv.filename = cmdenv.filename or "import.prices"
transfers.download(cmdenv, cmdenv.url, cmdenv.filename)
if cmdenv.download:
return None

# If the filename specified was "-" or None, then go ahead
# and present the user with an open file dialog.
Expand Down

0 comments on commit 7f5fc47

Please sign in to comment.