update cmd app
This commit is contained in:
parent
7ef930bc1c
commit
6039a3a494
@ -23,8 +23,14 @@ There's some handy test data in the `tests/data` directory. For example:
|
||||
gzip -dc tests/data/fdb_list_compact.gz| qubed convert --from=fdb --to=text --output=qube.txt
|
||||
gzip -dc tests/data/fdb_list_porcelain.gz| qubed convert --from=fdb --to=json --output=qube.json
|
||||
gzip -dc tests/data/fdb_list_compact.gz | qubed convert --from=fdb --to=html --output=qube.html
|
||||
|
||||
// Operational data stream=oper/wave/enfo/waef
|
||||
fdb list class=od,expver=0001,date=0,stream=oper --compact >> operational_compact.txt
|
||||
operational_compact.txt | qubed convert --from=fdb --to=text --output=operational.txt
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Todo
|
||||
|
||||
--from for
|
||||
|
@ -1,3 +1,4 @@
|
||||
import json
|
||||
import time
|
||||
|
||||
import click
|
||||
@ -107,7 +108,15 @@ def convert(input, output, from_format, to_format):
|
||||
n0 = q.n_leaves
|
||||
t = time.time()
|
||||
|
||||
output_content = str(q) if to_format == "text" else q.html().html
|
||||
if to_format == "text":
|
||||
output_content = str(q)
|
||||
elif to_format == "json":
|
||||
output_content = json.dumps(q.to_json())
|
||||
elif to_format == "html":
|
||||
output_content = q.html().html
|
||||
else:
|
||||
output_content = str(q)
|
||||
|
||||
output.write(output_content)
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user