Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] - Add JSON output to g.mapset #5518

Open
cwhite911 opened this issue Apr 7, 2025 · 5 comments
Open

[Feat] - Add JSON output to g.mapset #5518

cwhite911 opened this issue Apr 7, 2025 · 5 comments
Labels
enhancement New feature or request gsoc Reserved for Google Summer of Code student(s)
Milestone

Comments

@cwhite911
Copy link
Contributor

Add JSON output to g.mapset.

The addition should include outputs for the following commands.

  1. Print the current mapset and exit.
g.mapset -p format=json
{
    "project": "nc_spm_08_grass7",
    "mapset": "user1"
}
  1. List available mapsets and exit.
g.mapset -l format=json
{
    "project": "nc_spm_08_grass7",
    "mapsets": ["landsat" ,"new" ,"PERMANENT", "user1"]
}
  1. Create mapset if it doesn't exist
g.mapset -c mapset=user2 project=nc_spm_08_grass7 format=json

Output the new mapset.

{
    "project": "nc_spm_08_grass7",
    "mapset": "user2"
}
  1. Change current mapset
g.mapset mapset=user2 project=nc_spm_08_grass7

Output the current mapset.

{
    "project": "nc_spm_08_grass7",
    "mapset": "user2"
}
@cwhite911 cwhite911 added enhancement New feature or request gsoc Reserved for Google Summer of Code student(s) labels Apr 7, 2025
@cwhite911 cwhite911 moved this to Todo in GRASS JSON Outputs Apr 7, 2025
@cwhite911 cwhite911 added this to the 8.5.0 milestone Apr 7, 2025
@cwhite911
Copy link
Contributor Author

This is a template for future JSON related issues.

@petrasovaa
Copy link
Contributor

Not sure about points 3 and 4, I would say no output needed.

@wenzeslaus
Copy link
Member

The classic Unix tool approach to say nothing if the request operation was done.

@cwhite911
Copy link
Contributor Author

I was thinking about it more like a REST API.

@wenzeslaus
Copy link
Member

Do you have an example? For unix tools, there is plenty, rm is one, but interestingly Git is a counter example.

Ultimately, we want the tools to be useful, convenient, and predictable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request gsoc Reserved for Google Summer of Code student(s)
Projects
Development

No branches or pull requests

3 participants