mirror of
https://github.com/httpie/cli.git
synced 2026-06-20 11:32:56 +02:00
check --ssl-cert and --ssl-key to be files
This commit is contained in:
1 parent
14583a2efa
commit
b9d7220b10
2 files changed
+13
No files matched your search
@@ -1,4 +1,5 @@
|
||||
from __future__ import division
|
||||
import argparse
|
||||
|
||||
|
||||
def humanize_bytes(n, precision=2):
|
||||
@@ -44,3 +45,12 @@ def humanize_bytes(n, precision=2):
|
||||
break
|
||||
|
||||
return '%.*f %s' % (precision, n / factor, suffix)
|
||||
|
||||
|
||||
def existing_file(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