Skip to content

[Feat] Add JSON to g.findfile #6005

Open
@petrasovaa

Description

@petrasovaa

Is your feature request related to a problem? Please describe.
g.findfile needs JSON, it already has shell style output:

g.findfile file=elevation element=cell:

name='elevation'
mapset='PERMANENT'
fullname='elevation@PERMANENT'
file='/home/akratoc/grassdata/nc_spm_08_grass7/PERMANENT/cell/elevation'

JSON would use the same keys.

The -n flag wouldn't apply for JSON, we don't want quotes there.

g.findfile -l prints elements in plain output, we could add printing in json to lib/manage library, or we could just skip this and leave -l flag as is.

I did some changes in g.findfile in #5998 , they are not directly related, but should be merged first. One of the changes is introducing -t flag. When format is specified and without the -t flag, it should return success exit code even when nothing was found. The previous behavior reported error code when nothing was found, even though that's not an error. We need to keep that behavior for backwards compatibility, but with format we can introduce the new behavior.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions