Skip to content

Commit

Permalink
Dedup error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
hongquan committed Aug 9, 2021
1 parent 2005b80 commit 2b6976d
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 15 deletions.
12 changes: 7 additions & 5 deletions api/_public/main.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import ky from 'https://unpkg.com/ky';
import 'https://unpkg.com/@highlightjs/[email protected]/highlight.min.js';
import ky from 'https://unpkg.com/ky'
import 'https://unpkg.com/@highlightjs/[email protected]/highlight.min.js'
import 'https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/languages/shell.min.js'

window.app = function() {
return {
curl: '',
httpie: '',
errors: [],
async onSubmit() {
const { httpie } = await ky.post('/api/', { json: { curl: this.curl } }).json();
this.httpie = httpie;
const { httpie, errors } = await ky.post('/api/', { json: { curl: this.curl } }).json()
this.httpie = '$ ' + httpie
this.errors = errors
},
colorizeHttpie() {
return hljs.highlight(this.httpie, { language: 'bash' }).value
return hljs.highlight(this.httpie, { language: 'shell' }).value
}
}
}
2 changes: 1 addition & 1 deletion api/_public/tailwind.css

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions api/templates/index.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,14 @@
</div>
</div>

<ul>
<ul class='text-sm text-red-400'>
<template x-for='(err, i) in errors' :key='i'>
<li x-text='err'></li>
</template>
</ul>
</main>
<!-- built files will be auto injected -->
<footer class='prose container mx-auto w-full max-w-4xl px-2 pb-2 text-sm text-center'>
<footer class='prose container mt-4 mx-auto w-full max-w-4xl px-2 pb-2 text-sm text-center'>
<p>
Author: <a href='https://quan.hoabinh.vn'>Nguyễn Hồng Quân</a><br/>
Tool to demonstrate <a href='https://pypi.org/project/curlipie/'>CurliPie</a> ability.
Expand All @@ -67,8 +67,8 @@
<img class='mx-auto' src='https://madewithlove.vercel.app/vn?heart=true&colorA=%23ffcd00&colorB=%23da251d'>
</footer>
<script type='modulepreload' src='https://unpkg.com/ky'></script>
<script src='https://unpkg.com/@highlightjs/cdn-assets@11.0.1/highlight.min.js'></script>
<script type='module' src="{{ url_for('static', path='main.js?v=1') }}"></script>
<script src='https://unpkg.com/@highlightjs/cdn-assets@11.2.0/highlight.min.js'></script>
<script type='module' src="{{ url_for('static', path='main.js?v=2') }}"></script>
<script type='module' src='https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js'></script>
<script nomodule src='https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine-ie11.min.js' defer></script>

Expand Down
2 changes: 1 addition & 1 deletion curlipie/pie.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,4 @@ def curl_to_httpie(cmd: str, long_option: bool = False) -> ConversionResult:
if args.output:
param = '-o' if not long_option else '--output'
cmds.extend((param, quote(args.output)))
return ConversionResult(httpie=' '.join(cmds), errors=args._errors)
return ConversionResult(httpie=' '.join(cmds), errors=frozenset(args._errors))
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "curlipie"
version = "0.8.1"
version = "0.8.2"
description = "Library to convert cURL command line to HTTPie"
authors = ["Nguyễn Hồng Quân <[email protected]>"]
maintainers = [
Expand Down
29 changes: 26 additions & 3 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,43 @@
aiofiles==0.7.0; python_version >= "3.6" and python_version < "4.0"
asgiref==3.4.1; python_version >= "3.6"
atomicwrites==1.4.0; python_version >= "3.5" and python_full_version < "3.0.0" and sys_platform == "win32" or sys_platform == "win32" and python_version >= "3.5" and python_full_version >= "3.4.0"
attrs==21.2.0; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.5.0" and python_version >= "3.5"
click==8.0.1; python_version >= "3.6"
colorama==0.4.4; python_version >= "3.6" and python_full_version < "3.0.0" and sys_platform == "win32" and platform_system == "Windows" or sys_platform == "win32" and python_version >= "3.6" and python_full_version >= "3.5.0" and platform_system == "Windows"
dataclasses==0.8; python_version >= "3.6" and python_version < "3.7" and python_full_version >= "3.6.1"
devtools==0.5.1; python_version >= "3.5"
fastapi==0.65.3; python_version >= "3.6"
first==2.0.2
flake8==3.9.2; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
h11==0.12.0; python_version >= "3.6"
http-constants==0.4.0; python_full_version >= "3.6.0"
idna==3.2; python_version >= "3.6"
importlib-metadata==2.1.1; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_version >= "3.6" and python_version < "3.8" and python_full_version >= "3.5.0"
jinja2==3.0.1; python_version >= "3.6"
kiss-headers==2.3.0; python_full_version >= "3.6.0"
logbook==1.5.3
markupsafe==2.0.1; python_version >= "3.6"
mccabe==0.6.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
more-itertools==8.8.0; python_version >= "3.5"
multidict==4.7.6; python_version >= "3.5"
mypy-extensions==0.4.3
orjson==2.6.8; python_version >= "3.7"
packaging==21.0; python_version >= "3.6"
pluggy==0.13.1; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.5"
py==1.10.0; python_version >= "3.5" and python_full_version < "3.0.0" or python_full_version >= "3.4.0" and python_version >= "3.5"
pycodestyle==2.7.0; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pydantic==1.8.2; python_full_version >= "3.6.1"
pyflakes==2.3.1; python_version >= "2.7" and python_full_version < "3.0.0" or python_full_version >= "3.5.0"
pyparsing==2.4.7; python_version >= "3.6" and python_full_version < "3.0.0" or python_full_version >= "3.3.0" and python_version >= "3.6"
pytest-flake8==1.0.7
pytest==5.4.3; python_version >= "3.5"
python-rapidjson==0.9.4; python_version ~= "3.6"
single-version==1.5.1; python_version >= "3.6" and python_version < "4.0"
typed-argument-parser==1.6.3
starlette==0.14.2; python_version >= "3.6"
typed-argument-parser==1.7.0
typing-extensions==3.10.0.0; python_version < "3.8" and python_version >= "3.6" and python_full_version >= "3.6.1"
typing-inspect==0.6.0
typing-inspect==0.7.1
uvicorn==0.14.0
wcwidth==0.2.5; python_version >= "3.5"
yarl==1.6.3; python_version >= "3.6"
zipp==3.4.1; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_version >= "3.6" and python_version < "3.8" and python_full_version >= "3.5.0"
zipp==3.5.0; python_version >= "3.6" and python_full_version < "3.0.0" and python_version < "3.8" or python_version >= "3.6" and python_version < "3.8" and python_full_version >= "3.5.0"

1 comment on commit 2b6976d

@vercel
Copy link

@vercel vercel bot commented on 2b6976d Aug 9, 2021

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.