Prompt for file name if it's missing

pull/4/head
Casey Chu 2014-12-24 02:01:19 -08:00
parent f9f1f1e193
commit a38a1cbc57
1 changed files with 6 additions and 1 deletions

View File

@ -115,9 +115,14 @@ def main():
parser.add_argument('--token', metavar='OAUTH_TOKEN', help='use a Spotify OAuth token (requires the '
+ '`playlist-read-private` permission)')
parser.add_argument('--format', default='txt', choices=['json', 'txt'], help='output format (default: txt)')
parser.add_argument('file', help='output filename')
parser.add_argument('file', help='output filename', nargs='?')
args = parser.parse_args()
# If they didn't give a filename, then just prompt them. (They probably just double-clicked.)
if not args.file:
print "Enter a file name (e.g. playlists.txt):",
args.file = raw_input()
# Log into the Spotify API.
if args.token:
spotify = SpotifyAPI(args.token)