|
@@ -17,15 +17,18 @@ ioutils_formats_list = ["raw", "json", "table", "dict"]
|
|
|
def ioutils_dbres_print(ctx, oformat, ostyle, res):
|
|
|
""" print a database result using different formats and styles """
|
|
|
if oformat is None:
|
|
|
- if ioutils_tabulate_format is True:
|
|
|
- oformat = "table"
|
|
|
+ if ctx.oformat is None:
|
|
|
+ if ioutils_tabulate_format is True:
|
|
|
+ oformat = "table"
|
|
|
+ else:
|
|
|
+ oformat = "json"
|
|
|
else:
|
|
|
- oformat = "json"
|
|
|
- else:
|
|
|
- if oformat == "table":
|
|
|
- if ioutils_tabulate_format is False:
|
|
|
- ctx.log("Package tabulate is not installed")
|
|
|
- sys.exit()
|
|
|
+ oformat = ctx.oformat
|
|
|
+
|
|
|
+ if oformat == "table":
|
|
|
+ if ioutils_tabulate_format is False:
|
|
|
+ ctx.log("Package tabulate is not installed")
|
|
|
+ sys.exit()
|
|
|
|
|
|
if ostyle is None:
|
|
|
ostyle = "grid"
|