[GRASS-git] [OSGeo/grass] 6b42b8: r.info: Output comments as one string in JSON (#4216)

Vaclav Petras noreply at github.com
Wed Jan 15 15:35:17 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/OSGeo/grass
  Commit: 6b42b8d62bf80ce3a0e688a1596495f791acbaa5
      https://github.com/OSGeo/grass/commit/6b42b8d62bf80ce3a0e688a1596495f791acbaa5
  Author: Vaclav Petras <wenzeslaus at gmail.com>
  Date:   2025-01-15 (Wed, 15 Jan 2025)

  Changed paths:
    M raster/r.info/main.c
    M raster/r.info/testsuite/test_r_info.py

  Log Message:
  -----------
  r.info: Output comments as one string in JSON (#4216)

The part of history which appears under the comments key can be multiple lines and is stored in a format which limits line length. This is basically how r.info shows it by default in the plain output for humans. Long lines can be split and continuation is marked using a backslash.

This adds a function which puts the continued lines back together and adds newlines between the other lines. There is no newline at the end. This string is then serialized in JSON instead of the original list of strings.

This also avoids serializing the history twice when the h flag is not used, but it does change the behavior for what keys are included.



To unsubscribe from these emails, change your notification settings at https://github.com/OSGeo/grass/settings/notifications


More information about the grass-commit mailing list