-
-
Notifications
You must be signed in to change notification settings - Fork 362
g.findfile: Add JSON support #6091
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
Conversation
Signed-off-by: Nishant Bansal <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was not in the original issue, but please also change the python wrapper gs.find_file in python/grass/script/core.py to use parse_command with json, it should simplify the code slightly. Thanks!
Signed-off-by: Nishant Bansal <[email protected]>
Traceback (most recent call last):
File "imagery/i.cluster/testsuite/test_i_cluster.py", line 53, in setUp
if self._signature_exists():
File "imagery/i.cluster/testsuite/test_i_cluster.py", line 61, in _signature_exists
sig_file_path = os.path.join(
File "/usr/lib/python3.10/posixpath.py", line 76, in join
a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType Not sure, but it looks like using |
There is couple options here:
My choice here is number 2. It transitions to the new code while keeping 100% backwards compatibility and we can resolve the questionable usage separately. |
Signed-off-by: Nishant Bansal <[email protected]>
Fixes: #6005
This PR adds JSON support to the
g.findfile
module. The JSON output looks like:This PR includes the following changes:
format
option withshell
, andjson
modes for output formatting.-n
is ignored and-l
returns an error when using JSON format. If-t
is unset and nothing is found, return success in JSON format.