mirror of
https://github.com/httpie/cli.git
synced 2025-08-19 12:56:41 +02:00
rename existing_file to readable_file_arg and move to input
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
"""Parsing and processing of CLI input (args, auth credentials, files, stdin).
|
||||
|
||||
"""
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
@@ -630,3 +631,12 @@ def parse_items(items, data=None, headers=None, files=None, params=None):
|
||||
target[item.key] = value
|
||||
|
||||
return headers, data, files, params
|
||||
|
||||
|
||||
def readable_file_arg(filename):
|
||||
try:
|
||||
open(filename, 'rb')
|
||||
except IOError as ex:
|
||||
raise argparse.ArgumentTypeError(
|
||||
'%s: %s' % (filename, ex.args[1]))
|
||||
return filename
|
||||
|
Reference in New Issue
Block a user