Commit 25e2a39d authored by Łukasz Nowak's avatar Łukasz Nowak

cli: Allow to show command error

parent 340c944d
...@@ -5,11 +5,12 @@ from . import recurls ...@@ -5,11 +5,12 @@ from . import recurls
@click.command(short_help="Runs curl's wrapper recurl") @click.command(short_help="Runs curl's wrapper recurl")
@click.option('--headers/--no-headers', help="Shows response headers", default=False, show_default=True) @click.option('--headers/--no-headers', help="Shows response headers", default=False, show_default=True)
@click.option('--output/--no-output', help="Shows the output", default=False, show_default=True) @click.option('--output/--no-output', help="Shows the output", default=False, show_default=True)
@click.option('--verbose/--no-verbose', help="Show curl's output", default=False, show_default=True)
@click.option('--curl', help="Path to curl binary", default='curl', show_default=True) @click.option('--curl', help="Path to curl binary", default='curl', show_default=True)
@click.option('--follow/--no-follow', help="Follows redirects", default=False, show_default=True) @click.option('--follow/--no-follow', help="Follows redirects", default=False, show_default=True)
@click.option('--ip', help="IP to resolve to") @click.option('--ip', help="IP to resolve to")
@click.argument("url") @click.argument("url")
def runRecurl(headers, output, curl, follow, ip, url): def runRecurl(headers, output, verbose, curl, follow, ip, url):
mimikra = recurls.Recurls(curl) mimikra = recurls.Recurls(curl)
response = mimikra.get(url, ip=ip, allow_redirects=follow) response = mimikra.get(url, ip=ip, allow_redirects=follow)
print('Effective HTTP version:', response.effective_http_version) print('Effective HTTP version:', response.effective_http_version)
...@@ -24,3 +25,6 @@ def runRecurl(headers, output, curl, follow, ip, url): ...@@ -24,3 +25,6 @@ def runRecurl(headers, output, curl, follow, ip, url):
if output: if output:
print('Output:') print('Output:')
print(response.text) print(response.text)
if verbose:
print('curl output:')
print(response.command_error)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment