Skip to content

Commit 8000b58

Browse files
authored
Merge pull request #3547 from vkarak/feat/table-format-delim
[feat] Add new `--table-format-delim` option
2 parents d2ecc2a + f22b5ca commit 8000b58

File tree

5 files changed

+40
-1
lines changed

5 files changed

+40
-1
lines changed

docs/config_reference.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2118,6 +2118,14 @@ General Configuration
21182118
- ``pretty``: (default) Generate a pretty table
21192119

21202120

2121+
.. py:attribute:: general.table_format_delim
2122+
2123+
:required: No
2124+
:default: ``","``
2125+
2126+
Delimiter to use when emitting tables in CSV format.
2127+
2128+
21212129
.. py:attribute:: general.timestamp_dirs
21222130
21232131
:required: No

docs/manpage.rst

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,6 +1204,14 @@ Miscellaneous options
12041204

12051205
.. versionadded:: 4.7
12061206

1207+
.. option:: --table-format-delim[=DELIM]
1208+
1209+
Delimiter to use when emitting tables in CSV format using the :option:`--table-format=csv` option.
1210+
1211+
The default delimiter is ``,``.
1212+
1213+
.. versionadded:: 4.9
1214+
12071215
.. option:: --upgrade-config-file=OLD[:NEW]
12081216

12091217
Convert the old-style configuration file ``OLD``, place it into the new file ``NEW`` and exit.
@@ -2316,6 +2324,21 @@ Whenever an environment variable is associated with a configuration option, its
23162324

23172325
.. versionadded:: 4.7
23182326

2327+
.. envvar:: RFM_TABLE_FORMAT_DELIM
2328+
2329+
Delimiter for CSV tables.
2330+
2331+
2332+
.. table::
2333+
:align: left
2334+
2335+
================================== ==================
2336+
Associated command line option :option:`--table-format-delim`
2337+
Associated configuration parameter :attr:`~config.general.table_format_delim`
2338+
================================== ==================
2339+
2340+
.. versionadded:: 4.9
2341+
23192342

23202343
.. envvar:: RFM_TIMESTAMP_DIRS
23212344

reframe/frontend/cli.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,11 @@ def main():
697697
help='Table formatting',
698698
envvar='RFM_TABLE_FORMAT', configvar='general/table_format'
699699
)
700+
misc_options.add_argument(
701+
'--table-format-delim', action='store',
702+
help='The delimiter to use when using `--table-format=csv`',
703+
envvar='RFM_TABLE_FORMAT_DELIM', configvar='general/table_format_delim'
704+
)
700705
misc_options.add_argument(
701706
'-v', '--verbose', action='count',
702707
help='Increase verbosity level of output',

reframe/frontend/printer.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,9 @@ def performance_report(self, data, **kwargs):
277277
self.info('')
278278

279279
def _table_as_csv(self, data):
280+
delim = rt.runtime().get_option('general/0/table_format_delim')
280281
for line in data:
281-
self.info(','.join(str(x) for x in line))
282+
self.info(delim.join(str(x) for x in line))
282283

283284
def table(self, data, **kwargs):
284285
'''Print tabular data'''

reframe/schemas/config.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -538,6 +538,7 @@
538538
"save_log_files": {"type": "boolean"},
539539
"target_systems": {"$ref": "#/defs/system_ref"},
540540
"table_format": {"enum": ["csv", "plain", "pretty"]},
541+
"table_format_delim": {"type": "string"},
541542
"timestamp_dirs": {"type": "string"},
542543
"topology_prefix": {"type": "string"},
543544
"trap_job_errors": {"type": "boolean"},
@@ -609,6 +610,7 @@
609610
"general/resolve_module_conflicts": true,
610611
"general/save_log_files": false,
611612
"general/table_format": "pretty",
613+
"general/table_format_delim": ",",
612614
"general/target_systems": ["*"],
613615
"general/topology_prefix": "${HOME}/.reframe/topology",
614616
"general/timestamp_dirs": "%Y%m%dT%H%M%S%z",

0 commit comments

Comments
 (0)