Skip to content

Commit

Permalink
Recognize (but not convert) more curl flags
Browse files Browse the repository at this point in the history
  • Loading branch information
hongquan committed Feb 1, 2020
1 parent ae0c8ac commit 4631a23
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
24 changes: 24 additions & 0 deletions curlipie/curly.py
Expand Up @@ -28,15 +28,27 @@ class CURLArgumentParser(Tap):
verbose: bool = False
include: bool = False
location: bool = False
append: bool = False
silent: bool = False
fail: bool = False
show_error: bool = False
globoff: bool = False
insecure: bool = False
http1_0: bool = False
tlsv1: bool = False
sslv2: bool = False
sslv3: bool = False
netrc: bool = False
proxytunnel: bool = False
use_ascii: bool = False
no_buffer: bool = False
remote_name: bool = False
remote_time: bool = False
remote_header_name: bool = False
max_redirs: int = 0
max_time: float = 0
request: Optional[str] = None
proxy: Optional[str] = None
user: Optional[str] = None
header: List[str] = []
form: List[str] = []
Expand Down Expand Up @@ -66,14 +78,26 @@ def add_arguments(self):
self.add_argument('-v', '--verbose')
self.add_argument('-i', '--include')
self.add_argument('-L', '--location')
self.add_argument('-a', '--append')
self.add_argument('-s', '--silent')
self.add_argument('-f', '--fail')
self.add_argument('-S', '--show-error')
self.add_argument('-g', '--globoff')
self.add_argument('-k', '--insecure')
self.add_argument('-0', '--http1.0', dest='http1_0')
self.add_argument('-1', '--tlsv1')
self.add_argument('-2', '--sslv2')
self.add_argument('-3', '--sslv3')
self.add_argument('-n', '--netrc')
self.add_argument('-p', '--proxytunnel')
self.add_argument('-B', '--use-ascii')
self.add_argument('-N', '--no-buffer')
self.add_argument('-O', '--remote-name')
self.add_argument('-R', '--remote-time')
self.add_argument('-J', '--remote-header-name')
self.add_argument('-X', '--request')
self.add_argument('-m', '--max-time')
self.add_argument('-x', '--proxy', nargs='?')
self.add_argument('-u', '--user')
self.add_argument('-H', '--header', nargs='?', action='append')
self.add_argument('-d', '--data', nargs='?', action='append')
Expand Down
3 changes: 2 additions & 1 deletion curlipie/pie.py
Expand Up @@ -50,7 +50,6 @@ def curl_to_httpie(cmd: str, long_option: bool = False) -> ConversionResult:
if args.verbose:
cmds.append('--verbose' if long_option else '-v')
if args.location:
print('Need follow')
if long_option:
cmds.append('--follow')
else:
Expand All @@ -65,6 +64,8 @@ def curl_to_httpie(cmd: str, long_option: bool = False) -> ConversionResult:
cmds.append('--form')
else:
join_previous_arg(cmds, 'f')
if args.proxy:
cmds.extend(('--proxy', args.proxy))
if args.user or args._basic_auth:
user = args.user or args._basic_auth
if long_option:
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "curlipie"
version = "0.6.1"
version = "0.6.2"
description = "Library to convert cURL command line to HTTPie"
authors = ["Nguyễn Hồng Quân <ng.hong.quan@gmail.com>"]
maintainers = [
Expand Down

1 comment on commit 4631a23

@vercel
Copy link

@vercel vercel bot commented on 4631a23 Feb 1, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.